0
Hi, I wrote the code, but I can't understand why the results go from one to 45, they are from one to 23. Help me figure it out.
11 Réponses
+ 2
Just keep practicing 😀.
+ 1
Your question is not clear. Your code print 1, 3 and 5 on a separate lines. What is the purpose of your code ?
+ 1
The length of the array you declared is 23 => you have 23 places for numbers in that array. 23 is not the upper limit number of the elements in the array. Then each element is increasing with 2, starting with 1 => your first element. So the output is showing the expected result. Hope it helps you.
+ 1
No, it's because you are filling all places in your array. If you count the values they are exactly 23 => the length of the array you declared.
0
Sorry, a little wrong. Corrected code
0
The purpose of my code is to display odd numbers from 1 to 23
0
So the value doubles?
0
Now I understand 😀 thanks for the help
0
You are welcome 😀. You can see the lines I added in your code.
https://code.sololearn.com/cYY9tzsfXvvu/?ref=app
0
Great! That's exactly what I want. Comments help to understand. I should do that too 😀
0
I agree 😀