Modular operator : modulus operator « Operators statements « C++ Tutorial






#include <iostream>
using namespace std;
int main(void)
{
   int num;
   cout << "Enter a whole number: ";
   cin >> num;
   if ( num % 2 == 0 )
      cout << "The number is even" << endl;
   return 0;
}








3.5.modulus operator
3.5.1.The modulus operator.
3.5.2.Mod down by integer
3.5.3.Modular operator
3.5.4.Read int type variables and calculate mod value