# C Program to Compute Quotient and Remainder

In this example, we will learn to find the quotient and remainder when an integer is divided by another integer.

**Remainder :**

To understand this example, you must have the knowledge of the following C programming topics:

## Program to Compute Quotient and Remainder

`#include <stdio.h>`

int main() {

int dividend, divisor, quotient, remainder;

printf("Enter dividend : ");

scanf("%d", ÷nd);

printf("Enter divisor : ");

scanf("%d", &divisor);

quotient = dividend / divisor;

remainder = dividend % divisor;

printf("Quotient is %d and Remainder is %d", quotient, remainder);

return 0;

}

**Output **

Enter dividend : 37

Enter divisor : 4

Quotient is 9 and Remainder is 1

### Working of the above program

- First we declare integer character variables
`dividend`,`divisor`to store the value of dividend and divisor entered by the user and`remainder`,`quotient`to store the results.

`int dividend, divisor, quotient, remainder;`

`scanf()`function and store the entered value in variable

`dividend`.

`printf("Enter dividend : ");`

scanf("%d", ÷nd);

`scanf()`function and store the entered value in variable

`divisor`.

`printf("Enter divisor : ");`

scanf("%d", &divisor);

`dividend`by

`divisor`and store the value in

`quotient`variable.

`quotient = dividend / divisor;`

`%`modulus operator to get the remainder when we divide

`dividend`with

`divisor`.

remainder = dividend % divisor;

`quotient`and

`remainder`using

`printf()`function.

`printf("Quotient is %d and Remainder is %d", quotient, remainder);`