Write a loop that displays all possible combinations of two letters where the letters are 'a', or 'b', or 'c', or 'd', or 'e'. The combinations should be displayed in ascending alphabetical order:
aa
ab
ac
ad
ae
ba
bb
...
ee
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
run a for loop from a to e. for each of those letters, run a loop from a to e.
for(char ch1='a'; ch1<='e'; ch1++) {
for(char ch2='a'; ch2<='e'; ch2++) {
cout<<ch1<<ch2<<endl;
}
}