Click here to load reader
Upload
suneerav17
View
22
Download
3
Embed Size (px)
Citation preview
www.w3professors.com Gursharan Singh Tatla Page No. 1
/*
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--)
{
www.eazynotes.com Gursharan Singh Tatla Page No. 2
if (j <= k)
printf("%d", j);
else
printf("%d", k);
}
putchar('\n');
}
getch();
}