+ 1
(Solved)Sololearn question that I dont understand.
I need to writte the output of: For (n=1; n<10; n+=2) Console.Write(n); And the answers says that is 13579, how?
3 Réponses
+ 4
in first iteration value of "n" is 1 and that is what printed first. After that value of "n" is increased by 2 on every step and is printed without any space between them
Thus the answer 13579.
+ 2
1° iteration n=1//output 1; n=1
2° iteration n = n+2//output 3; n=3
3° iteration n = n+2 //output 5;n=5
4° iteration n = n+2// output 7;n=7
5° iteration n = n+2//output 9 n=9
However 6° iteration n = n+2 // n=11;
(n is not smaller 10) and the loop end.
+ 1
Omgggg, I understand now, I throught that its was Console.WriteLine, not just "Line", I should had paid more attention, my bad 😣, thanks both for your help! 🙇