C Programming |
How To Make Continuous Vertical-Horizontal Number Pyramid Posted: 14 Dec 2014 10:39 AM PST Q. Write a C program of Continuous Vertical Horizontal Number Pyramid design as: 1 6 2 10 7 3 13 11 8 4 15 14 12 9 5 Ans. Before we starting the coding of above number pyramid design, let's focus the following source image of above pyramid:
So, In above pyramid design it is too easy to making every rows and columns. let's starting the writing source code. /*c program for continuous vertical horizontal number pyramid*/ #include<stdio.h> int main() { int r,c,a=1,b,y,z=5; for(r=1; r<=5; r++, a=a+7-r, z--) { b=a; y=z; for(c=1; c<=r; c++, b=b-y++) printf(" %d ",b); 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