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; }
2 odpowiedzi
+ 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