Skip to main content
Search
Search This Blog
Patterns
Different types of Pyramids.
Share
Get link
Facebook
X
Pinterest
Email
Other Apps
September 11, 2017
Pattern 23
// Pyramid
#include<stdio.h>
int main()
{
int i,j,s;
for(i=1;i<=5;i++)
{
for(s=5;s>=i;s--) // for loop that prints spaces.
{
printf(" ");
}
for(j=1;j<=i*2;j=j+2) // for loop that prints numbers.
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
Comments
Popular Posts
September 02, 2017
Pattern 17
Comments
Post a Comment