/*C program to print number
series pattern.
For n=4,
1
2 3
4 5 6
7 8 9 10
*/
#include<stdio.h>
int main()
{
int i, j, n, count=1;
printf("Enter your number:");
scanf("%d", &n);
for (i=0; i<n; i++)
{
for(j=0; j<=i; j++)
printf("%d ", count++);
printf("\n");
}
return 0;
}
|
Output of the
Program:
Enter your number:4
1
2 3
4 5 6
7 8 9 10
No comments:
Post a Comment