Saved Bookmarks
| 1. |
Write a program in C to make such a pattern like a pyramid with numbers increased by 1. By using loop (06)& &&&&& &&&& |
Answer» Program in C to make such a pattern like a pyramid with numbers increased by 1Explanation: void main() { int i,j,spc,rows,K,t=1; printf("Input NUMBER of rows : "); scanf("%d",&rows); spc=rows+4-1; for(i=1;i<=rows;i++) { for(k=spc;k>=1;k--) { printf(" "); } for(j=1;j<=i;j++) printf("%d ",t++); printf("\n"); spc--; } } The output of the program will be for four rows, as seen in the ATTACHED picture. |
|