C Programming language

adplus-dvertising
C Program example: Print alphabet triangle in alphabet order
Previous Home Next
Print alphabet triangle

In this example we are going to print alphabets triangle which first line has A, second line B C ,third line D E F and so on .For this we are using two for loops.

#include<stdio.h>
#include<conio.h>          
void main()                
{                          
	int i,j,k=65;              
	clrscr();		    
	for(i=65;i<=70;i++)
	{
		for(j=65;j<=i;j++)
			printf("%c",k++);
		printf("\n");
	}
	getch();
}
Output:

A
B  C
D  E  F
G  H  I  J
K  L  M  N  O

Previous Home Next