Skip to content

Program to Compute Quotient and Remainder in C

#include <stdio.h>

int main()
{
int dividend, divisor, quotient, remainder;

printf(“Enter the dividend: “);
scanf(“%d”, &dividend);

printf(“Enter the divisor: “);
scanf(“%d”, &divisor);

quotient = dividend / divisor;
remainder = dividend % divisor;

printf(“Quotient = %d\n”, quotient);
printf(“Remainder = %d\n”, remainder);

return 0;

}

Explanation

  • / is the division operator and gives the quotient.
  • % is the modulus operator and gives the remainder.
  • For 25 / 4:
    • Quotient = 6
    • Remainder = 1