Contact Learn C
Copy

Program 146:Reverse Alpha Pyramid 2

Program 146:

#include<stdio.h>
main()
{
    int i,j,k,rows,count,temp,alpha;
    printf("Enter number of rows till 5:\n");
    scanf("%d",&rows);
    count=0;
     // using formula a+(n-1)*d
    temp=1+(rows-1)*2;
    alpha=65;
    for(i=1;i<=rows;i++)
    {
        for(j=1;j<=count;j++)
        {
            printf(" ");
            
        }
        for(k=1;k<=temp;k++)
        {
            printf("%c",alpha);
                alpha++;
        }
        count++;
        temp-=2;
    
        printf("\n");
    }    
}

Explanation:

//Coming Soon...

Output:
Reverse Alpha Pyramid 2






 
Donate

Download App and Learn when ever you want

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