In: Computer Science
The code will be as follows
#include<iostream>
using namespace std;
int main()
{
int i = -5;
while(-5 <= i && i <=0)
{
cout << "!";
--i;
}
}
Now, "!" will be printed 1 time
because for the 1st time i = -5 and the condition in the while loop satisfies, condition is true, the statements inside loop execute. so, "!" will print then i will decrement by 1, therefore for the next iteration (2nd) i = -6 and the condition in the while loop fails. since -5 is not less than or equals to -6 (-5 <= i fails) so, statements inside loop will not execute.
The code and output in Visual Studio
Answer: "!" will be printed 1 time.