C Program to compute Quotient and Remainder of two numbers

In this program, we take two numbers as input from user and calculate quotient and reminder.

C Program to Compute Quotient and Remainder :

In the below program, to find the quotient and remainder of the two numbers, the user is first asked to enter two numbers. The inputs are scanned using the scanf() function and stored in the variables A and B. Then, the variables A and B are divided using the arithmetic operator / to get the quotient as result stored in the variable quotient; and using the arithmetic operator % to get the remainder as result stored in the variable remainder.

Example :

	
#include <stdio.h>
int main()
{
    int a,b,quotient = 0, remainder = 0;
    
    printf("Enter dividend: ");
    scanf("%d",&a);
    printf("Enter divisor: ");
    scanf("%d",&b);
    
    quotient= a/b;
    remainder= a%b;
    
    printf("quotient: %d, remainder: %d\n",quotient,remainder);
    
    return 0;
}
	

Output :

	
        Enter dividend: 100
		Enter divisor: 3
		quotient: 33, remainder: 1
	

Share your thoughts

Ask anything about this examples