Header Ads

Opposite Pascal Triangle Using Alphabets

Write a program to create the following Pyramid using C program?
           A B C D E F
       A B C D E
         A B C D
          A B C
            A B
              A


******************************Program********************

#include<stdio.h>
#include<conio.h>
main()
{
 int r,c,k,m,i;
 printf("Enter the number of lines : ");
 scanf("%d",&m);
 for(r=0;r<=m-1;r++)
    {
        i=0;
        for(k=0;k<=r;k++)
        {
            printf(" ");
        }
        for(c=1;c<=m-r;c++)
        {
            printf(" %c",65+i);
            i++;
        }
        printf("\n");
    }
    getch();
 return 0;
}


******************************Output**********************

screen shot for opposite pascal triangle using alphabets

No comments