Q. How to print or wap to a E-Shape Pyramid in C language as?
*****
*
***
*
*****
Ans.
/*e-shape pyramid in c*/
#include<stdio.h>
int main()
{
int num=5,r,c;
for(r=1; r<=num; r++)
{
if(r%2==0)
printf("*");
else if(r%3==0)
{
for(c=1; c<=r; c++)
printf("*");
}
else
{
for(c=1; c<=num; c++)
printf("*");
}
printf("\n");
}
getch();
return 0;
}
You might also like:
*****
*
***
*
*****
Ans.
/*e-shape pyramid in c*/
#include<stdio.h>
int main()
{
int num=5,r,c;
for(r=1; r<=num; r++)
{
if(r%2==0)
printf("*");
else if(r%3==0)
{
for(c=1; c<=r; c++)
printf("*");
}
else
{
for(c=1; c<=num; c++)
printf("*");
}
printf("\n");
}
getch();
return 0;
}
/***********************************************************
The output of above program would be:
***********************************************************/
Figure: Screenshot for E-Shape Pyramid Program In C |
You might also like:
- How to print M Shape Pyramid Program
- Big list of 98+ C pyramid Programs
- Latest 100+ Pyramid Programs list
- How To Print V Shape Pyramid In C
No comments:
Post a Comment