/* To print Pyramid Pattern shown below
2
3 4
4 5 6
5 6 7 8
6 7 8 9 10
*/
#include<stdio.h>
int main()
{
int i,j,n,k=2;
printf("Enter no. of lines: ");
scanf( "%d",&n);
//for loop for number of lines
for(i=1;i<=n;i++)
{
k=i+1;
for(j=1;j<=i;j++)
{
printf("%d ",k);
k++;
}
printf("\n");
}
return 0;
}
0 comments: