What will be printed out as a result of the following code execution?
#include <iostream>

int main() {
    int result = 0;
    while (result < 5)
        ++result;
    do result += 2;
    while (++result < 5);
    std::cout << result;    
}
Explanation
Get an explanation when it's available:

@maptun thanks! fixed formatting

2017 Dec 6, 12:59:12 PM

Code not formated What will be printed out as a result of the following code execution? #include <iostream> int main() { int result = 0; while (result < 5) ++result; do result += 2; while (++result < 5); std::cout << result; }

2017 Sep 6, 12:52:18 PM

C++
C++ Quiz
Start Quiz

or Read more about C++ Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback