To print output like
1
2 3
4 5 6
7 8 9 1
2 3 4 5 6
To print pyramid output
Hope you liked my posts, give comments if you have any doubts.. :)
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#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();
}
To print pyramid output
Hope you liked my posts, give comments if you have any doubts.. :)
Categories:
c program
,
Special Codes
,
Star Codes
0 comments:
Post a Comment