C Program to compute Quotient and Remainder of two numbers
- Home
- Calculations
- C Program to compute Quotient and Remainder of two numbers
- On
- By
- 0 Comment
- Categories: Calculations, Operators
C Program to compute Quotient and Remainder of two numbers
C Program to compute Quotient and Remainder of two numbers
In this tutorial, we will discuss the concept of C Program to compute Quotient and Remainder of two numbers When the one number divided by another
In this topic, we are going to learn how to calculate quotient and remainder of two numbers in C programming language

What is quotient and remainder
To find the quotient, we have used the division(/) operator. we have divided (dividend by divisor) two numbers
To find remainder, we have use modular(%) operator . The dividend is divide by the divisor and the remainder is returned by the modular(%) operator
C program to find quotient and remainder
Program to find quotient and remainder
Program 1
In this program, the user initialize two integer numbers using two variables as dividend and divisor and then the program calculates the quotient and remainder of the given numbers using division and modular operator
#include <stdio.h>
#include <stdlib.h>
int main()
{
int dividend=500,divisor=40;
//Declare integer variables
int quotient,remainder;
//Declare integer variables
quotient=dividend/divisor;
//Calculate quotient
remainder=dividend%divisor;
//Calculate remainder
printf("Quotient = %d\n",quotient);
//Display quotient
printf("Remainder = %d\n",remainder);
//Display remainder
getch();
return 0;
}
When the above code is executed, it produces the following result
Quotient: 12 Remainder: 20
Program to find quotient and remainder-Entered by user
Program 2
the program allows to enter two integer and then the program calculates the quotient and remainder the given numbers using division and modular operator
#include <stdio.h>
#include <stdlib.h>
int main()
{
int dividend,divisor;
//Declare integer variables
int quotient,remainder;
//Declare integer variables
printf("Enter dividend: " );
//Ask to enter dividend
scanf("%d",÷nd);
//Reading the dividend from user
printf("Enter divisor: " );
//Ask to enter divisor
scanf("%d",&divisor);
//Reading the divisor from user
quotient=dividend/divisor;
//Calculate quotient
remainder=dividend%divisor;
//Calculate remainder
printf("Quotient = %d\n",quotient);
//Display quotient
printf("Remainder = %d\n",remainder);
//Display remaunder
getch();
return 0;
}
When the above code is executed, it produces the following result
Enter dividend: 222 Enter divisor: 15 Quotient: 14 Remainder: 12
Suggested for you
input output function in C language
Function in C language
Similar post
C Program to Divide of two integer numbers
Java Program to Divide of two integer numbers
C++ Program to Divide of two integer numbers
Python Program to Divide of two integer numbers
C Program to Divide of two integer numbers using function
Java Program to Divide of two integer numbers using method
C++ Program to Divide of two integer numbers using function
Python Program to Divide of two integer numbers using function
Java code to find quotient and remainder
C code to find quotient and remainder
C++ code to find quotient and remainder
Python code to find quotient and remainder