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:45 AM
Lungu
Lungu - avatar
2 Answers
0
Because you have initialized a=1 therefore it's displaying 1 and waiting for getting next input
19th Feb 2020, 10:58 AM
Mukul Singh Bhist
Mukul Singh Bhist - avatar
0
I tried to only declare 'a' and input a value >9 and the output was 0.
19th Feb 2020, 11:01 AM
Lungu
Lungu - avatar