0
[Please help ]Write a c++ program that accpet an integer number from the user ,in case the number is negative check and print out whether it is even or odd number
3 ответов
+ 6
#include <iostream>
using namespace std;
int main ()
{
int num;
cout << "Please input an integer : ";
cin >> num;
if (num < 0)
{
cout << "The negative integer is ";
if (num % 2 == 0)
{
cout << "even." << endl;
}
else { cout << "odd." << endl; }
}
else { cout << "The input number is a positive integer." << endl; }
return 0;
}
0
why are you posting your class works here
0
Its not class work ok i have an exam and i didnt know how to slove this one so i ask help why i can't ask someone help?