WAP in C to print full pyramid using *?

#include<stdio.h>
#include<conio.h>
int main()
{
int i, s, rows, k=0;
clrscr();
printf(“Enter number of rows: “);
scanf(“%d”,&rows);
for(i=1; i<=rows; ++i, k=0)
{
for(s=1; s<=rows-i; ++s)
{
printf(” “);
}
while(k != 2*i-1)
{
printf(“* “);
++k;
}
printf(“\n”);
}
getch();
return(0);
}

Output :-

6.png

Advertisements

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