0

what would happen if i put "num = num -1;" in this cycle

int num = 1; while (num < 6) { cout << "Number: " << num << endl; num = num + 1; }

10th Oct 2016, 5:06 AM
Andresgallo10
Andresgallo10 - avatar
1 Antwort
0
Congratulations! You just have created an infinite loop! Since your statement (num < 6) ALWAYS will be true, the program will print infinite numbers. I don't recommend doing that, by the way...
10th Oct 2016, 5:11 AM
German Martinez
German Martinez - avatar