Programming Examples

C Program to Compute Quotient and Remainder


Write a C Program to input dividend, divisor and Compute Quotient and Remainder

Solution

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

    // Computes quotient
    quotient = dividend / divisor;

    // Computes remainder
    remainder = dividend % divisor;

    printf("Quotient = %d\n", quotient);
    printf("Remainder = %d", remainder);
    return 0;
}
▶ RUN

Output/ Explanation:

Enter dividend: 25

Enter divisor: 4

Quotient = 6

Remainder = 1 

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad