Answer to Question #13553 in C++ for Peter
Write a C program to display the following number triangle structure:
54321
4321
321
21
1
1
2012-08-23T11:56:09-0400
#include<stdio.h>
int main()
{
int num,r,c,sp;
printf("Enter
number of rows: ");
scanf("%d", &num);
for(r=1; r<=5;
r++,num--)
{
for(sp=r; sp>1; sp--)
printf(" ");
for(c=num;
c>=1; c--)
printf("%d",c);
printf("\n");
}
getch();
return
0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment