A
BB
CCC
DDDD
Example
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
char c;
clrscr();
printf("Enter the value of n:");
scanf("%d",&n);
c=65;
for(i=0;i<=n;i++)
{
for(j=0;j<=i;j++)
{
printf("%c",c);
}
c++;
printf("\n\n");
}
getch();
}
/*=====================================================================
OUTPUT
Enter the value of n:4
A
BB
CCC
DDDD
Both loop must start with the initial value 1 , or just remove = sign from the outer loop .
ReplyDeletehere 0 will count as firts position (it just a position)
DeleteA
ReplyDeleteBB
CCC
DDDD
CCC
BB
A
This comment has been removed by the author.
DeleteA
ReplyDeleteB B
C C C C
D D D D D