# C Program to calculate out Quotient and Remainder

In this C Programming example, we will implement the program to find out the quotient and remainder of the numbers entered by the user and print the output on the console.

## 1. Quotient and Remainder

In the following program, based on the user’s input the quotient and remainder are calculated using a user-defined function.

```Example

Input:
Dividend is: 6
Divisor is: 2

Output:
Quotient is: 3
Remainder is: 0```

Helpful topics to understand this program better are-

## 2. C Program to find out the quotient and remainder

Let’s discuss the execution(kind of pseudocode) for the program to find out the quotient and remainder of the numbers entered by the user in C.

1. Initially, the program will prompt the user to enter the two numbers. The values are then stored in dividend and divisor accordingly.
2. Then we call a function to calculate the quotient and remainder, `q = quotient(number1, number2)` and `r = remainder(number1, number2)` and store the result in `q` and `r` respectively.
3. We print the quotient(q) and the remainder(r) on the console.

Let us now implement the above execution of the program to find out the quotient and remainder in C.

```#include <stdio.h>
int quotient(int x, int y){
return x / y;
}

int remainder(int x, int y){
return x % y;
}

int main(){
int number1, number2, q, r;
printf("Enter the dividend: ");
scanf("%d", &number1);
printf("Enter the divisor: ");
scanf("%d", &number2);

q = quotient(number1, number2);
r = remainder(number1, number2);

printf("Quotient is: %d\n", q);
printf("Remainder is: %d", r);
return 0;
}```

Note: The numbers entered must be of integer data type, but the code can be formatted for other data types like- float, double.

```Output
Enter the dividend: 5
Enter the divisor: 2
Quotient is: 2
Remainder is: 1
```

## 3. Conclusion

In this C Programming example, we have discussed how to find out the quotient and remainder in C.

Also for the example C programs please refer to C Programming Examples.

All examples are hosted on Github.

#### Recommended Books

An investment in knowledge always pays the best interest. I hope you like the tutorial. Do come back for more because learning paves way for a better understanding

Do not forget to share and Subscribe.

Happy coding!! 😊

### Recommended -

Subscribe
Notify of 