+ 1

14.2 Even or Odd

Running into “expected primary expression before %” On line 9. https://sololearn.com/coach/264/?ref=app

24th May 2021, 2:49 PM
Jax
6 Respostas
+ 9
You need to use num as an input variable to take any inputs from the compiler. It's not necessary to declare output variables at the beginning #include <iostream> using namespace std; int main() { //int odd; //int even; int num; cin>>num; if (num%2 == 0){ cout<<"even"<<endl; } else {cout<<"odd"<<endl;} return 0; }
24th May 2021, 3:08 PM
Simba
Simba - avatar
+ 3
Jax To solve any problem you must know the syntax. Just reading cover of the book will not help you to know more about that book. So don't leave the basic concepts and syntax. It was very basic syntax to get reminder and compare reminder with other value.
24th May 2021, 4:17 PM
A͢J
A͢J - avatar
+ 1
Thanks, you’re the real Deal lol.
24th May 2021, 3:14 PM
Jax
0
Ive move the paranthesis to (num% ==0) and still get the error
24th May 2021, 3:03 PM
Jax
0
Can anyone please help me ,I'm having problem with unlocking the PRO ,can any one carry me along?🙏
24th May 2021, 5:14 PM
Balogun Yusuff Isola
- 1
#include <iostream> using namespace std; int main() { int odd; int even; int num; if (num)% == 0{ cout<<"even"<<endl; } else {cout<<"odd"<<endl;} return 0; }
24th May 2021, 3:00 PM
Jax