+ 1

When I input 2 it prints human and not human. Should just print human. Tried to get rid of the else statement , it didn't work.

https://code.sololearn.com/cJuCovz5zu5u/?ref=app

22nd Oct 2018, 6:29 PM
Dels White
Dels White - avatar
4 Answers
+ 9
I think that's what you want #include <iostream> using namespace std; int main() { int a; cin >> a; if(a == 2) cout << "human" << endl; else if(a <= 1) cout << "sorry for your loss" << endl; else { cout << "not human" << endl; if (a >= 5) cout << "what are you" << endl; } return 0; }
22nd Oct 2018, 7:46 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 9
Welcome, well keep practicing and you'll master it one day. Everything looks hard at the beginning :)
22nd Oct 2018, 8:11 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 4
You have forgotten your curlies. Like this, only one statement belongs to your first if, and the second if and the else belong together. Or wait, you want three options, right? Then you can change the second if to 'else if'.
22nd Oct 2018, 6:39 PM
HonFu
HonFu - avatar
+ 3
thank you, I don't know why this was so hard for me. It works now
22nd Oct 2018, 8:09 PM
Dels White
Dels White - avatar