The program to find remainder is usually implemented using a modulo operator. You get the immediate result with any difficulty. However, there is another way to achieve the same results without using the modulo operator.

This is a frequent question asked in lot of C programming interviews to test the aptitude of the candidates. So it is a well known problem and it solution is also known to most of the C learners.

This program is written using Turbo C++ 3.0 compiler installed on a windows XP 32-bit system. You are free to use any standard C compiler and still achieve the same results.

### Problem Definition

The program receives an input numbers – divisor and a dividend. The quotient of the division is easily obtained using the division operator (/).

Now we cannot use the modulo operator and have to find another way to find the remainder.There are two steps to do that

- Find and intermediate number by multiplying quotient * divisor.
- subtract the intermediate number from dividend.

For example, divisor , dividend , find the remainder.

quotient

intermediate number

remainder = dividend – intermediate number

remainder

Check the flowchart below to understand this logic.

### Flowchart

### Program Code

```
#include
#include
void main()
{
int n1,n2,quotient,reminder;
clrscr();
printf("Enter two numbers:\n");
scanf("%d %d",&n1,&n2);
quotient = n1/n2;
reminder = n1 - quotient * n2;
printf("Remainder = %d\n",reminder);
getch();
}
```

### Output

The output of the above program is given below.