Q:

pattern program 10 (C language)

belongs to collection: Pattern Programs in C

0

pattern program 10 (C language)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program - 10

/*C program to print following Pyramid:
    1        1
    12      21
    123    321
    1234  4321
    1234554321
*/

#include<stdio.h>

int main()
{
	int i,j,k,l,m=8,n=1;
	for(i=1; i<=5; i++)
	{
		for(j=1; j<=i; j++)
		{
			printf("%d",j);
		}            
		for(k=m; k>=1; k--)            
		{
			printf(" ");
		}
			m = m-2;
		for(l=n; l>=1; l--)
		{
			printf("%d",l);
        }
  		n = n+1;
	    printf("\n");            
       }
       
       return 0; 
}

Output

    1        1
    12      21
    123    321
    1234  4321
    1234554321

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

pattern program 11 (C language)... >>
<< pattern program 9 (C language)...