0
How can I repeat this using the 'for' loop? (Please read the description)
I want to repeat this alphabet: Β,Β,D,D, F,F,…….Z,Z using the 'for' loop. Can someone please explain me how to do this?
5 Antworten
+ 3
My idea is to have a char variable, let's name it <c>. Next, assign 'B' to it, then you setup the for loop; condition is while <c> <= 'Z'.
In loop body you print <c> twice with a comma in between. You need to increment <c> by 2.
+ 2
I did it! Thank you very much for helping me!
+ 2
I'm glad you made it! 👍
+ 1
Only those characters?
What defines the range? as we can see it started with 'B' and ended with 'Z'
An output example (as you expected it to be) may help others to understand.
0
The output should look like this: B,B, D,D, F,F, H,H, J,J, L,L, N,N, P,P, R,R, T,T, V,V, X,X, Z,Z