This program to compute quotient and remainder is written using Turbo C++ 3.0 running in a DOS Box 0.74 for Windows 7 64-bit system. You can compile this program using any other compiler and it will still work.This program is intended for beginners who know how to operate a computer.

### Problem Definition

To find the quotient and the remainder is very easy and anyone can do it much help. By writing a program to find the quotient and remainder, we are doing two things

- Understand how to write a program using a programming language.
- All computer programs are based on some logic or algorithm. So we understand the logic behind the computation. It increases our problem-solving ability.

The algorithm to find a quotient and a remainder is based on the Euclidian algorithm. We said “based on” because the purpose of the *Euclidean algorithm* is to find *greatest common divisor (GCD)* of two or more numbers.

Given two numbers, **‘a’ ** which is dividend and **‘b’** which is divisor.

** **

a = qb + r

** **

Where **‘q’** is the quotient and **r** is the remainder. This is the logic behind the division.The program has two integers as an input and it gives a quotient and a remainder as the output.

**How are we going to process the output?**

The program performs a simple division as follows

```
q = a/b
r = a % b
```

Where **‘a’** and **‘b’** are two integers.

### Flowchart – Program to find Quotient and Remainder

### Program Code

```
#include <stdio.h>
#include <conio.h>
main()
{
int dnd, div, quotient, remainder;
int i;
//Enter Input Numbers 'a' and 'b'
printf ("Enter the dividend:");
scanf ("%d", &dnd);
printf ("Enter the divisor :");
scanf ("%d",&div);
//Compute Quotient and Remainder
quotient = dnd/div;
remainder = dnd % div;
//Print the Results
for(i=0;i<20;i++)
printf("_");printf("\n\n");
printf ("Quotient = %d\n", quotient);
printf ("Remainder= %d\n", remainder);
for(i=0;i<20;i++)
printf("_");printf("\n");
getch ();
return 0;
}
```

### Output

The following is the correct output of the program.