Finding the Remainder Between Two Numbers - C++ Operator

C++ examples for Operator:Arithmetic Operator

Description

Finding the Remainder Between Two Numbers

Demo Code

#include <iostream> 
using namespace std; 
  
int main(int argc, const char * argv[]) 
{ 
        cout << "Enter your first number: " << endl; 
        int number1 = 0; 
        cin >> number1; /*from w  w  w.ja v  a 2 s . c  o m*/
  
        cout << "Enter your second number: " << endl; 
        int number2 = 0; 
        cin >> number2; 
  
        int result = number1 % number2; 
        cout << "The remainder from dividing your second number into your first is: " 
                << result << endl; 
        return 0; 
}

Result


Related Tutorials