How can i by way of a for loop, print each letter of the alphabet 23 times on a row in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i by way of a for loop, print each letter of the alphabet 23 times on a row in c++

C++

29th Nov 2017, 11:37 AM
Boansi Kufuor Oliver
Boansi Kufuor Oliver - avatar
2 Answers
+ 3
for(int i=0;i<26;i++) { for(int j=0;j<23;j++) cout<<char(65+i); cout<<endl; }
29th Nov 2017, 12:02 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
0
for (char c = 'a'; c != 'z'; ++c) { for (short i = 0; i != 23; ++i) cout << c; cout << endl; }
29th Nov 2017, 3:02 PM
Timon Paßlick