Contact Learn C
Copy

Program 158:Left Alpha Pyramid 4

Program 158:

Method I
#include<stdio.h>
main()
{
    int i,j,alpha,rows,temp;
    printf("Enter number of rows:\n");
    scanf("%d",&rows);
    printf("\n");
    for(i=1;i<=rows;i++)
    {
     
     alpha=64+rows;
        for(j=1;j<=i;j++)
        {
            printf("%c ",alpha);
            alpha--;
        }        
        printf("\n");
    }  
   
 for(i=rows-1;i>=1;i--)
 {
  alpha=64+rows;
  for(j=i;j>=1;j--)
  {
   printf("%c ",alpha);
    alpha--;
  }  
 
  printf("\n");
 }  
}
Method II 
 
#include<stdio.h>
#include<stdlib.h>
main()
{
    int i,j,alpha=65,rows,temp;
    printf("Enter number of rows:\n");
    scanf("%d",&rows);
    
    for(i=rows;i>=-rows;i--)
    {
        for(j=rows-1;j>=abs(i);j--)
        {
            printf("%c ",alpha+j);
            
        }        
        printf("\n");
    }  
}

Explanation:

//Coming Soon...

Output:


Left Alpha 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