C Programming |
How to make continuous number pyramid with Zero Posted: 17 Feb 2015 08:46 AM PST Q. Write a C program to make a continuous number pyramid with adding digit "Zero" as: 1 02 003 0004 00005 000006 0000007 00000008 000000009 Ans. /*c program for making a continuous number pyramid*/ #include<stdio.h> int main() { int r,c; printf("1\n"); for(r=2; r<=9; r++) { for(c=1; c<=r; c++) { if(c==r) printf("%d",r); else printf("0"); } printf("\n"); } getch(); return 0; } /*********************************************************** The output of above program would be: ***********************************************************/
You might also like: |
You are subscribed to email updates from C Programming To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
Post a Comment