Please help me!

Please help me writing this code in c++, I have no idea where to start!

Odd/Even: Find whether a number is odd or even (use mod operation).

a) Prompt user to enter a number (say, x).
b) Determine if x is an even/odd number and output an appropriate message.
c) Compute the squire of the number (say, x^2).
d) Determine if x^2 is an even or odd number and output an appropriate
message.
Like I said before...

you haven't posted your code... at least try
Here's a quick answer.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
int main()
{
    int x;
    std::cout << "Enter number to determine if it's odd or even: ";
    std::cin >> x;
    std::cout << '\n';
    if (x % 2 == 0)
    {
        std::cout << "This number is even\n";
    }
    else
    {
        std::cout << "This number is odd\n";
    }
    if (((x * x) % 2) == 0)
    {
        std::cout << "The square of this number is even\n";
    }
    else
    {
        std::cout << "The square of this number is odd\n";
    }
    std::cin.ignore(); // Pauses (optional)
    return 0;
}
Topic archived. No new replies allowed.