The 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.
#include <iostream> using namespace std; int main() { int I = 1; while (I <= 10) cout << "hello"; return 0; }
It 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.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The 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.
It 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.