Triangle of alphabets Pattern using C

//Pattern


#include<stdio.h>

int main()
{
int h,i,j;

printf("Enter the height");
scanf("%d",&h);


for(i=1;i<=h;i++)
{
 for(j=1;j<20-i;j++)
  printf("  ");
 for(j=1;j<=i;j++)
  printf("%c ",64+j);//123//ABC
 for(j=j-2;j>=1;j--)
  printf("%c ",64+j);//21//BA      ABCBA
 printf("\n");
}
}



Comments

Popular posts from this blog

Pascal Triangle using 2D array

JAVA program to add two distance