R4R
Right Place For Right Person TM
 
R4R C C ExamplesPrint Alphabet Triangle
previous

Home

Next

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

A
AB
ABC
ABCD
ABCDE

previous

Home

Next

New Updates

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R