Skip to content
Home » C Program to Compute Quotient and Remainder

C Program to Compute Quotient and Remainder

Learn about C Program to Compute Quotient and Remainder in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Compute Quotient and Remainder

In this program, the user is requested to provide two integers (dividend and divisor), which will be placed in the variables dividend and divisor, respectively. The quotient is then evaluated using the division (/) operator and stored in the variable quotient.

Program:

#include<stdio.h>
int main()
{
     int dividend, divisor, quotient, remainder;
     printf("Enter dividend: ");
     scanf("%d", &dividend);
     printf("Enter divisor: ");
     scanf("%d", &divisor);

     // Compute quotient
     quotient = dividend / divisor;

     // Compute remainder
     remainder = dividend % divisor;

     // print results
     printf("Quotient = %d\n", quotient);
     printf("Remainder = %d\n", remainder);
     return 0;
}

Output:

Enter dividend: 25
Enter divisor: 4
Quotient = 6
Remainder = 1

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Compute Addition Subtraction and Multiplication
Finding out the Age in Terms of Years, Months and Days in C