C program to find quotient and remainder; Through this tutorial, we will learn how to find quotient and remainder based on the dividend & divisor values entered by user in c program.

## Programs to Find Quotient and Remainder

- Algorithm to Find Quotient and Remainder
- C Program to Find Quotient and Remainder
- C Program to Find Quotient and Remainder using function

## Algorithm to Find Quotient and Remainder

Use the following algorithm to write a program to find quotient and remainder; as follows:

- Step 1: Start program.
- Step 2: Read two numbers from user and store them into variables.
- Step 3: Multiply two floating point numbers and store result in variable.
- Step 4: Print multiply two floating point numbers.
- Step 5: End program.

## C Program to Find Quotient and Remainder

```
#include <stdio.h>
int main(){
int num1, num2, quot, rem;
printf("Enter dividend: ");
scanf("%d", &num1);
printf("Enter divisor: ");
scanf("%d", &num2);
/* The "/" Arithmetic operator returns the quotient
* Here the num1 is divided by num2 and the quotient
* is assigned to the variable quot
*/
quot = num1 / num2;
/* The modulus operator "%" returns the remainder after
* dividing num1 by num2.
*/
rem = num1 % num2;
printf("Quotient is: %d\n", quot);
printf("Remainder is: %d", rem);
return 0;
}
```

The output of the above c program; as follows:

Enter dividend: 10 Enter divisor: 5 Quotient is: 2 Remainder is: 0

## C Program to Find Quotient and Remainder using function

```
#include <stdio.h>
// Function to computer quotient
int quotient(int a, int b){
return a / b;
}
// Function to computer remainder
int remainder(int a, int b){
return a % b;
}
int main(){
int num1, num2, quot, rem;
printf("Enter dividend: ");
scanf("%d", &num1);
printf("Enter divisor: ");
scanf("%d", &num2);
//Calling function quotient()
quot = quotient(num1, num2);
//Calling function remainder()
rem = remainder(num1, num2);
printf("Quotient is: %d\n", quot);
printf("Remainder is: %d", rem);
return 0;
}
```

The output of the above c program; as follows:

Enter dividend: 50 Enter divisor: 2 Quotient is: 25 Remainder is: 0