Generation Next Technology
Every student can learn, just not on the same day, or the same way
Thursday, December 10, 2009
WAP to generate the peramid pattern
Write a program to generate the following pattern:
Output:-
1
121
12321
1234321
123454321
Solution:-
#include
#include
void main()
{
int i,j;
for (i=1;i<=5;i++) { for(j=4;j>=i;j--)
{
printf(" ");
}
for(j=1;j<=i;j++) { printf("%d",j); } printf("\n"); } getch(); }
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Search This Blog
No comments:
Post a Comment