C Programming |
Continuous Vertical Number Pyramid Posted: 15 May 2014 02:16 AM PDT Q. Write a C program to print the following continuous vertical number pyramid design as: 1 2 7 3 8 13 4 9 14 19 5 10 15 20 25 Ans. /*c program for continuous vertical number pattern*/ #include<stdio.h> int main() { int num,r,c,z,n; printf("Enter maximum no. of rows : "); scanf("%d", &num); for(r=1; r<=num; r++,z=num) { for(c=1,n=r; c<=r; c++,n=n+z) printf("%d ",n); printf("\n"); } getch(); return 0; } /**************************************** The output of above program would be: ***************************************/
|
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., 20 West Kinzie, Chicago IL USA 60610 |
Post a Comment