modulo c++ code example
Example 1: Mod in c++
if (iNum % 2 == 0)
{
cout << num << " is even ";
}
// % is used to mod numbers
Example 2: modulo c++
#include <iostream>
using namespace std;
int main() {
cout << 11%3; // Prints 2
}
Example 3: find mod in cpp
// Mode(%) => to get remainder
1 % 10 = 1
2 % 10 = 2
10 % 10 = 0