modulo in 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
}
if (iNum % 2 == 0)
{
cout << num << " is even ";
}
// % is used to mod numbers
#include <iostream>
using namespace std;
int main() {
cout << 11%3; // Prints 2
}