0

Why my code is showing error?

#include<iostream> using namespace std; int main(){ int n; cin>>n; if (n%2==0); { cout<<even<<endl; } else { cout<<odd<<endl; } return 0; }

10th Nov 2020, 3:34 AM
Hamza
2 Answers
+ 6
You need to put quotes around "even" and "odd" as they should be strings. You also need to remove the semicolon after the if condition closing parentheses. if (n%2==0); <--- remove ; here
10th Nov 2020, 3:39 AM
ChaoticDawg
ChaoticDawg - avatar
10th Nov 2020, 3:53 AM
Sâùtôsh
Sâùtôsh - avatar