mod operator c++ code example
Example 1: Mod in c++
if (iNum % 2 == 0)
{
cout << num << " is even ";
}
// % is used to mod numbers
Example 2: find mod in cpp
// Mode(%) => to get remainder
1 % 10 = 1
2 % 10 = 2
10 % 10 = 0
if (iNum % 2 == 0)
{
cout << num << " is even ";
}
// % is used to mod numbers
// Mode(%) => to get remainder
1 % 10 = 1
2 % 10 = 2
10 % 10 = 0