Contact Learn C
Copy

Program 369: Left Number Pyramid 4

Program 369: Left Number Pyramid 4
 
#include<stdio.h>
main()
{
    int i,j,k,rows,count,temp,c;
    printf("Enter number of rows:\n");
    scanf("%d",&rows);
    
    for(i=1;i<=rows;i++)
    {
     c=1;
        for(j=1;j<=i;j++)
        {
         if(c!=1)
          printf("0");
            else
                printf("1");
           c++;
        }
        printf("\n");
    }  
    
 for(i=rows-1;i>=1;i--)
 {
  c=1;
  for(j=i;j>=1;j--)
  {
   if(c!=1)
    printf("0");
   else
    printf("1");
    c++;
  }
  printf("\n");
 }  
}
Explanation:
 //Coming Soon


Output:
Left Number Pyramid 4
Donate

Download App and Learn when ever you want

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