Program to print pattern using for loop
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
#include<stdio.h>
main()
{
int row,i,j,c=1;
printf("Enter the number of
rows you want: \n");
scanf("%d",&row);
for(i=1;i<=row;i++)
{
for(j=1;j<=i;j++)
{
printf("%3d
",c);
c++;
}
printf("\n");
}
}
Enter the
number of rows you want: 5
1
2 3
4
5 6
7
8 9 10
11
12 13 14 15