+ 1

Pyramid out of letters

I tried to make a pyramid out of letters but i am not that familiar with how to change letters i made one but i got a result a little but different from what i expected Char a='a'; for(int i =1;i<=5;i++){ For(int j=0;j<i;j++){ System.out.print(a +" "); a++; } System.out.println(" "); } The result a b c d e f g h i j k l m n o What i expected a a b a b c etc and i know that there are codes already made about pyramids out of letters but i wrote the question in order to understand how to change letters and so on .

18th Sep 2020, 11:16 AM
Dareen Moughrabi
Dareen Moughrabi - avatar
2 ответов
+ 3
Put a='a' in first for loop.
18th Sep 2020, 11:20 AM
Vadivelan
+ 1
Oh thank you its clear and easy to understand
18th Sep 2020, 11:22 AM
Dareen Moughrabi
Dareen Moughrabi - avatar