Is there anyone who know the watermelon answer? Also is this correct? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Is there anyone who know the watermelon answer? Also is this correct?

#include <iostream> using namespace std; Int main () { int w; cin << w; If (w % 2 == 0) & & 2<w {cout << "YES";} else {cout << "NO";} return 0;}

5th Aug 2018, 4:44 PM
Rahaf Abuqwaider
Rahaf Abuqwaider - avatar
2 Antworten
+ 1
Rahaf Abuqwaider there are couple of errors as below: c++ is case sensitive..so, Int main should be int main... If should be if >> operator is overloaded for cin.. so, it should be cin >> w && should be used without space in if condition... If it's used with space, compiler might assume it as bitwise & and expect operands accordingly If statement condition should be enclosed with paranthesis.. it should be if() not directly if
5th Aug 2018, 5:15 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
#include <iostream> using namespace std; int main() { int w; cin >> w; if(w % 2 == 0 && 2 < w) { cout << "YES"; } else { cout << "NO"; } return 0; } ftfy
5th Aug 2018, 6:37 PM
hinanawi
hinanawi - avatar