Hi I need to create a program that makes the user input numbers and the program then tells them if the number is even or odd. ill be back in an hour. get to work.
Are you asking for our help, you asking for the answer? I can not speak for everyone, but I will not answer you with a complete program just because you need it.
I hope you didnt register for this site explicitly because you needed an answer.
#include <iostream>
usingnamespace std;
//Function to find out if a number is even or odd
void findNum(int input)
{
}
int main()
{
//Input variable
int input = 0;
//Bool for the while loop
bool go = true;
//Beginning display message
//While loop
while(go)
{
findNum(input);
}
//Exit with zero
return 0;
}
I want you to fill out the display message and even or odd function. Hint: use modulus.
An even function has reflectional symmetry about the y-axis, while an odd function has rotational symmetry about the origin. In other words, feven(x) = feven(-x), whereas fodd(x) = -fodd(-x). That should help you out.
I'd like to make it clear enough for you @gghf. A number is even if n modulus 2 equals 0. A number is odd if it isn't even. I hope you understood that, and with the code given above, you shouldn't have any problems.