Number Pyramid Structure Posted: 06 Sep 2013 10:17 PM PDT Q. Write a C program to print the following number pyramid structure design as: 1 2 3 4 52 3 4 53 4 54 55 Ans. /*c program for number pyramid pattern design*/#include<stdio.h>int main(){ int num,r,c; printf("Enter no of rows : "); scanf("%d", &num); for(r=1; r<=num; r++) { for(c=r; c<=num; c++) printf("%d ",c); printf("\n"); } getch(); return 0;} /*************************************************************The output of number pyramid pattern design program would be:**************************************************************/
| Figure: Screen-shot for number pyramid pattern C program |
|
Post a Comment