How many times will the following loop print hello? I = 1; while (I <= 10) cout << "hello"?
54711-Nov-2021
Updated on 06-Jun-2023
Home / DeveloperSection / Interviews / How many times will the following loop print hello? I = 1; while (I <= 10) cout << "hello"?
Aryan Kumar
06-Jun-2023The loop will print "hello" 10 times. The variable I is initialized to 1, and the loop will run while I is less than or equal to 10. The cout statement will print "hello" each time the loop runs.
Mukul Goenka
11-Nov-2021It print "hello" infinite time. because loop has three part initialization, condition, and updation. In this program initialization and condition have word but updation in not work so value of "I" in not update. So all time value "I" is 1 , so condition is always true.