INDEX

7.16.2016

Continuous Number Pattern C Program

Q. Write a C program to make the following continuous number pattern as: 1 2 6 3 7 10 4 8 11 13 5 9 12 14 15Ans.Before write to start the C coding, first of all you should the understand the concept of above number pattern.

Figure: Source design of number pattern C program

Now it is easy to make the program, now you know that where from to start and how the program execute or run.let's start the writing the source code of above continuous number pattern C program:/* continuous number pattern C program source code*/#include<stdio.h>int main(){int num,n,r,c,p; printf("Enter Total No. of Row : "); scanf("%d", &num);for(r=1; r<=num; r++) {for(c=1, p=r, n=num; c<=r; c++, n--, p=p+n) printf(" %d ", p); printf("\n"); } getch();return 0;}