Sunteți pe pagina 1din 2

www.w3professors.

com

Gursharan Singh Tatla

/*
Program to Print the Following Output:
1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
*/

#include <stdio.h>

main()
{
int i, j, k, space, n=9;

for (i=1; i<=n; i++)


{
for (j=1; j<=n-i; j++)
putchar(' ');

for (j=1,k=2*i-1; j<=2*i-1; j++,k--)


{

Page No. 1

www.eazynotes.com

Gursharan Singh Tatla

if (j <= k)
printf("%d", j);
else
printf("%d", k);
}
putchar('\n');
}

getch();
}

Page No. 2

S-ar putea să vă placă și