. Write a C program to print the following number decrease to zero triangle
pattern as:
0
101
21012
3210123
432101234
Ans.
/*c
program for number decrease triangle*/
#include<stdio.h>
int main()
{
int num,r,c,sp;
printf("Enter max number : ");
scanf("%d", &num);
for(r=0; r<=num; r++)
{
for(sp=r; sp<num; sp++)
printf(" ");
for(c=r; c>=0; c--)
printf("%d",c);
for(c=1; c<=r; c++)
printf("%d",c);
printf("\n");
}
getch();
return
0;
}
No comments:
Post a Comment