/* Pascal triangle in c*/
#include<stdio.h>
int main()
{
int line,a,b,c;
printf("Enter the no. of lines: ");
scanf("%d",&line);
for(a=1;a<=line;a++)
{
for(b=1;b<=line-a;b++)
printf(" ");
for(c=1;c<a;c++)
printf(
"%d" ,c);
for(c=a;c>=1;c--)
printf("\n");
}//end of first loop
}//end of main
/*output*/
1
1
121
12321
1234321
123454321
No comments:
Post a Comment