Modulus Operator
Modulus Operator:
Modulus operator is used to take out the remainder.
Program:
#include < iostream >
using namespace std;
int main()
{
int num;
cout << "Enter the number please" << endl;
cin >> num;
if (num % 2 == 0)
{
cout << "number is even" << endl;
}
else
{
cout << "Number is odd" << endl;
}
return 0;
}
Comments
Post a Comment