Learn C with example
Print alphabets triangle in C
In this example we are going to create an alphabets
triangle.
In this example we are going to make a triangle which
have A in first row B B into second row ,C C C in second
row and so on ..For this we are using two for loops.
Source Code Of the Examples
/* A
B B
C C C
D D D D
E E E E E */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
int n;
clrscr();
printf("Enter the ASCII character\t");
scanf("%d",&n);
for(i=65;i<=n;i++)
{
for(j=65;j<=i;j++)
printf("%c",i);
printf("\n");
}
getch();
}
|
Output Of Example
| Enter the ASCII
character 70 A
B B
C C C
D D D D
E E E E E |
Tolal:1 Click:
1
Username :Kiran Sone
Comments :Nice. Thank you. :-)
URL :http://r4r.co.in/c/examples/basic/shtml/Print_alphabet%20_traingle.shtml
1
Show All Comments