PROGRAM TO DRAW PYRAMID SERIES IN C
- This program is intended to draw number pyramids in c.
- The output looks like this
0 1 2 3 4 5.. if the number you input is 3.
- By this pgm u could input the number of rows and get the pyramid
#include <stdio.h>
main()
{
int i,n,j,s=0;
printf("num ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{for (j=1;j<=i;j++)
{printf("%d ",s++);
}
printf("\n");
}
}
Comments
Post a Comment