0

Why is this code bringing 1as the output??

#include <iostream> using namespace std; int main() { int a; a=1; do { cout << a << endl; cin>> a; a++; } while(a <= 9); return 0; }

19th Feb 2020, 10:46 AM
Lungu
Lungu - avatar
2 Antworten
+ 2
Because variable a intialized in 1 and its value outputs first. The code outputs 1 and waits for user input. Enter any number to continue execution.
19th Feb 2020, 10:53 AM
andriy kan
andriy kan - avatar
0
Thanks
19th Feb 2020, 11:01 AM
Lungu
Lungu - avatar