57.2k views
1 vote
C++ what is the result of this code,

for (imp=0; imp <3; imp++)
{

cout << imp;

}

User Bojana
by
8.7k points

1 Answer

6 votes

Step-by-step explanation:

This code will print the values of the variable imp on the console for each iteration of the loop. Specifically, it will print the numbers 0, 1, and 2, since the loop will run 3 times due to the condition imp < 3.

Each number will be printed on a new line, since the cout statement is followed by a newline character by default.

C++ what is the result of this code, for (imp=0; imp <3; imp++) { cout <&lt-example-1
User Andy Day
by
8.1k points