+ 3

My code isn't working properly pls help.

I want a program which will print x is 9 if it is nine and x is 5 then print x is 5 and if its not 9 or 2 then print x is not 5 or 9 https://code.sololearn.com/cHo0uajX6U8N/?ref=app

11th Apr 2018, 4:42 PM
Shahil Ahmed
Shahil Ahmed - avatar
1 Respuesta
+ 2
you have to put closing brackets } at the end of the block that should be done if the condition is true not to the end of program #include <iostream> using namespace std; int main(){ int x; cin>>x; if (x == 9){ cout<<"x is 9"; } if (x == 5){ cout<<"x is 5"; } else{ cout<<"x is not 5 or 9"; }}
11th Apr 2018, 4:48 PM
michal