pattern

/*pattern

G F E D C B A
 F E D C B A
  E D C B A
   D C B A
    C B A
     B A
      A

      */
#include<stdio.h>
#include<conio.h>

void main()
{
int p=65,n,m,i,j,t;
clrscr();

printf("\nEnter the height of the pattern : ");
scanf("%d",&n);
printf("\n\n");
for(i=n-1;i>=0;i--)
{
p=65+i;
for(j=0;j<n-i;j++)
printf(" ");
for(j=0;j<=i;j++)
printf("%c ",p--);
printf("\n");
}
getch();
}

I/O :

Comments

Popular posts from this blog

Pascal Triangle using 2D array

JAVA program to add two distance