odd and even test wont work

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
using namespace std;

int main ()
{
cout << "please type in any number to define whether it is odd or even" << endl;
cout << "If for some reason you cannot think" << endl;

int value;
cin >> value;

if(value / 2 = 0 && % = 0)
    cout << "your number is even";

if(value / 2 = 0 && % != 0)
    cout << "your number is odd";

    if(value = 0)
        cout << "your number is undefined, try a different number.";
}


i am getting errors for expected primary expression before %, =, and !=
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<iostream>
using namespace std;

int main() {

	int value = 0;

	cout << "Enter your number." << endl;
	cin >> value;

	if (value % 2 == 0) {
		cout << "Number is even."<< endl;}
	else {cout << "Number is odd." << endl;}

	system ("pause");

	return 0;}
Topic archived. No new replies allowed.