# Program to find remainder without using modulo or % operator in C++

C++Server Side ProgrammingProgramming

In this tutorial, we will be discussing a program to find how to find remainder without using modulo or % operator.

For this we will be provided with two values ‘num’ and ‘divisor’. Our task is to divide them both and print out the remainder but without using modulo or % operator.

## Example

Live Demo

#include <iostream>
using namespace std;
//returning remainder without using %
int getRemainder(int num, int divisor) {
return (num - divisor * (num / divisor));
}
int main() {
cout << getRemainder(100, 7);
return 0;
}

## Output

2
Published on 19-May-2020 15:17:52