Learn C with example
Print Alphabets Triangle
In this example we are going to make an alphabetic
triangle.
In this example we are going to print A
in first row .In second row we are going to print A B , in third line we
are going to print A B C and so on .
For this we are using two for loop
.First for loop is used for row and second is used to print column. We
are using %c to print the character value of integer.
Source Code Of example :
#include<stdio.h>
#include<conio.h> /* A */
void main() /* A B */
{ /* A B C */
int i,j; /* A B C D */
clrscr(); /* A B C D E */
for(i=65;i<=69;i++)
{
for(j=65;j<=i;j++)
printf("%c",j);
printf("\n");
}
getch();
}
|
Output Of Example