You are currently viewing Best Alphabet Triangle with Increasing Gap printing in 2023

Best Alphabet Triangle with Increasing Gap printing in 2023

Code for Alphabet Triangle with Increasing Gap printing

For learning c code, students are advised to practice few basic codes. For learning loop, nested loop you should go through this code. This code is designed for printing Alphabet Triangle with Increasing Gap.

In C code practice, this Alphabet Triangle with Increasing Gap printing logic plays a very important role. So I have designed this code as easy as possible for the students. They will be able to understand each and every step very easily. 

Before going for this type of program a student should go through basics of loops, nested loop etc. So that they can easily go through each step with self explanation mode. 

For more code click here. For video tutorial on several topics click here

#include<stdio.h>

void main()
{
char ch;
int i,j,m;

printf("Enter the height of the pattern " );
scanf("%d",&m);

for(i=0;i<=m/2;i++)
{
ch='A';
for(j=0;j<m;j++)
{
if(j>m/2-i && j<m/2+i)
printf(" ");
else
printf("%c",ch);

if(j>=m/2)
ch--;
else
ch++;

}
printf("\n");
}
}

Leave a Reply