1 // ConsoleApplication1.cpp : main project file.
2
3 #include "stdafx.h"
4 #include <conio.h>
5 #include <stdio.h>
6
7 using namespace System;
8
9 int main(array<System::String ^> ^args)
10 {
11 int matriz[10][10];
12 int n;
13 printf("Ingrese n: ");
14 scanf("%d",&n);
15 printf("\n");
16 for(int i= 0; i<n*2-1; i++)
17 {
18 for(int j = 0; j <n*2-1;j++)
19 {
20 if(((i+j<n*2-2) && (i<j))||((i+j>n*2-2) && (i>j)))
21 {
22 printf(" ",j);
23 }else
24 {
25 if(n-j>0)
26 printf("%d ",n-j);
27 else
28 printf("%d ",(n-j)*-1+2);
29 }
30 }
31 printf("\n");
32 }
33 _getch();
34 }
35
Enlace
El enlace para compartir es: