+ 1

Write a program to print

a a b a b c a b c d a b c d e

5th Jan 2017, 4:13 PM
priyanshu
priyanshu - avatar
6 Réponses
+ 3
#include <iostream> using namespace std; int main() { for (int i = 0; i<=5; i++){ char a = 'a'; for (int j=0; j<i; j++){ cout<<a++; } cout<<endl; } return 0; }
5th Jan 2017, 4:50 PM
Waheed Rehman
Waheed Rehman - avatar
+ 2
You need to loop twice, take a look to my code: https://code.sololearn.com/cL21OApUzTpx/?ref=app
5th Jan 2017, 4:44 PM
Michael Isac Girardi
Michael Isac Girardi - avatar
+ 2
#include <iostream> using namespace std; int main() { string c=""; char a = 'a'; for (int i=0; i<5; i++) { c+=a; cout << c <<endl; a++; } return 0; }
5th Jan 2017, 5:31 PM
ASNM
ASNM - avatar
0
please give me the answer with help of for loop
5th Jan 2017, 4:23 PM
priyanshu
priyanshu - avatar
0
hey priyanshu aren't we Coc buddy
10th Jan 2017, 6:33 PM
Prateek Yadav
Prateek Yadav - avatar
0
include<iostream> using namespace std; int main() { chat A=`a`; for (int i=0;i<=5;i++){ A=`a`; for(int j=0;j<=i;j++){ cout<<A; A++; } } return 0; }
4th Feb 2017, 3:14 PM
@Aayush@.
@Aayush@. - avatar