Last Updated :
10 Apr, 2024
How many times GeeksCourse is printed
#include <iostream>
using namespace std;
int main()
{
int i = -5;
while (i <= 5)
{
if (i >= 0)
break;
else
{
i++;
continue;
}
cout << \"GeeksCourse \\n\";
}
return 0;
}
(A) 10 times
(B) 5 times
(C) Infinite times
(D) 0 times
Answer: (D)
Explanation: The loop keeps incrementing i while it is smaller than 0. When i becomes 0, the loop breaks. So GeeksCourse is not printed at all.
Share your thoughts in the comments
Please Login to comment...