Division in C - C Program to Compute Quotient and Remainder



 c program to compute quotient and remainder

Learn C - C tutorial - c program to compute quotient and remainder - C examples - C programs

C Program to Compute Quotient and Remainder

  • Binary operator returns the quotient after divide, let suppose if dividend is 12 and divisor is 4, then quotient will be 3.
  • Binary operator modulus returns the remainder, let suppose if dividend is 10 and divisor is 3, then remainder will be 1.
  • In this c program, we will read dividend and divisor and find the quotient, remainder.

Sample Code

#include <stdio.h>
int main()
{
    int dividend=65,divisor=17,q,r;
    printf("dividend:65\n ");
    printf("divisor:17\n ");
    q= dividend / divisor;
    r= dividend % divisor;
    printf("Quotient = %d\n", q);
    printf("Remainder = %d", r);
    return 0;
}

Output

dividend:65
 divisor:17
 Quotient = 3
Remainder = 14


View More Quick Examples


Related Searches to Division in C - C Program to Compute Quotient and Remainder