0

Can anyone explain this why the number does not increase in the loop?

for(int x=0;x=10;x++) {cout<<x;}

28th Apr 2022, 2:21 AM
King
King - avatar
2 odpowiedzi
+ 1
In your condition you are setting x to equal 10 not testing it. Try something that says less than or equal to.
28th Apr 2022, 2:30 AM
William Owens
William Owens - avatar
+ 1
Try x!=10 for loop syntax for(initialize variable ; while variable isnt some condition ; update variable ) { Repeat this code } Conditions == != < <= > >=
28th Apr 2022, 2:32 AM
Raul Ramirez
Raul Ramirez - avatar