User Solution 30_6

Solution for the question ask by our user.

C programming source code for following pattern or triangle



1   1   1
 2  2  2 
  3 3 3
   444   
123454321
   444
  3 3 3
 2  2  2
1   1   1

#include<stdio.h>
void main()
{

int i,j,k,l,no=1;
clrscr();

for(i=1;i<5;i++)
{
for(k=1;k<i;k++)
{
printf(" ");
}
for(j=1;j<4;j++)
{
printf("%d",i);
for(l=4;l>i;l--)
{
printf(" ");
}
}

printf("\n");

}

for(i=1;i<=5;i++)
{
printf("%d",i);
}
for(i=4;i>=1;i--)
{
printf("%d",i);
}
        printf("\n");
for(i=4;i>=1;i--)
{
for(k=1;k<i;k++)
{
printf(" ");
}
for(j=1;j<4;j++)
{
printf("%d",i);
for(l=4;l>i;l--)
{
printf(" ");
}
}

printf("\n");

}

getch();
}

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.