How we will print this by loop
A
AA
ABA
ABCA
ABCDA
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char a='A';
for(int i=1;i<6;i++)
{
a='A';
for(int j=i;j>0;j--)
{
if(j==1)
{
cout<<"A";
}
else
{
cout<<a;
}
a++;
}
cout<<endl;
}
}
No comments:
Post a Comment