Contact Learn C
Copy Program Share Program

Program 161:Right Number Pyramid 2

Program 161:

#include<stdio.h>
main()
{
    int i,j,k,rows,count,start;
    printf("Enter number of rows:\n");
    scanf("%d",&rows);
    printf("\n");
    count=rows-1;
    
    for(i=1;i<=rows;i++)
    {
     start=1;
     for(k=1;k<=count;k++)
     {
      printf(" ");
     }
        for(j=1;j<=i;j++)
        {
            printf("%d",start);
   start++;            
        }
        
        count--;
        printf("\n");
    }  
   count=1;
      for(i=rows-1;i>=1;i--)
    {
     start=1;
     for(k=1;k<=count;k++)
        {
      printf(" ");
     }
        for(j=1;j<=i;j++)
        {
            printf("%d",start);
            start++;
        }
        count++;
       
        printf("\n");
    } 
}
Explanation:

//Coming Soon...

Output:


Right Number Pyramid 2

 

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide