February 4, 2011

C Program To Print Pyramid of Numbers

To print output like
1
2  3
4  5  6
7  8  9  1
2  3  4  5  6


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c=1;
clrscr();
for(i=1;i<=5;i++)
{ printf("\n");
for(j=1;j<=i;j++)
{
printf("%4d",c);
c++;
if(c>9)
{
c=0;
c++;
}
}
}
getch();
}

Also read

To print pyramid output

Hope you liked my posts, give comments if you have any doubts.. :)

Related Posts :



0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Related Posts with Thumbnails