TASK-
Write a C program to print following pyramid!!!
Note : We are not going to specify the size of pattern!!!
CODE:
#include<stdio.h>
int main(){
int n,i,j,o=1;
printf("Enter number of rows of upper triangle: ");
scanf("%d",&n);
printf("\n");
for (i=1;i<=n;i++)
{
for (int s=n-i;s>0;s--)
printf(" ");
for (j=0;j<o;j++)
{
printf("*");
}
printf("\n");
o=o+2;
}
o=o-2;
for (i=1;i<=(n-1);i++)
{
o=o-2;
for (int s=0;s<i;s++)
printf(" ");
for (j=0;j<o;j++)
printf("*");
printf("\n");
}
getchar();
return 0;
As Already stated --> we are not specifying the size hence see the Expected output!!
For more pyramid programs --> Pyramid
EXPECTED OUTPUT:
Awesome programming
ReplyDelete