C++ Online Compiler
Example: Basic Modulo Operation in C++
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// Basic Modulo Operation #include <iostream> int main() { // Step 1: Declare two positive integer variables int dividend = 10; int divisor = 3; // Step 2: Perform the modulo operation int remainder = dividend % divisor; // Step 3: Print the result std::cout << "10 % 3 = " << remainder << std::endl; return 0; }
Output
Clear
ADVERTISEMENTS