Draw Pyramid pattern using c language

How To print Pyramid Pattern shown below
2
3 4
4 5 6
5 6 7 8
6 7 8 9 10

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;
}

About these ads

About samay2011

blogger
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s