// Pyramid
#include<stdio.h>
int main()
{
int i,j,k=0;
for(i=1;i<=5;i++) // for loop that prints *.
{
for(j=5;j>i;j--)
{
printf("*");
}
for(j=i;j>=1;j--) // for loop that prints characters.
{
if(j==2 || j==4)
{
printf("%c",j+64);
}
else
{
printf("%d",j);
}
}
printf("\n");
}
return 0;
}
Comments
Post a Comment