Program to find quotient and remainder using function in C
- Home
- Calculations
- Program to find quotient and remainder using function in C
- On
- By
- 0 Comment
- Categories: Calculations, Operators
Program to find quotient and remainder using function in C
Program to find quotient and remainder using function in C
In this tutorial, we will discuss the concept of Program to find quotient and remainder using function in C 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 using function 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 one by another
To find remainder, we have use modular(%) operator . The dividend is divided 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 using function
Program 1
In this program, the user initialize two integer numbers using two variables as quotient and remainder and then the program calculates the quotient and remainder of the given numbers using function in C language
#include <stdio.h>
#include <stdlib.h>
//user define function for find quotient
void findQuotient(int a, int b){
int Quotient= a/b;
printf("Quotient = %d",Quotient);
}
//user define function for find remainder
void findRemainder(int a, int b){
int Remainder =a%b;
printf("\nRemainder %d",Remainder);
}
int main()
{
int dividend=1900,divisor=70;
//integer variable declaration
findQuotient(dividend,divisor);
//Call the function for display quotient
findRemainder(dividend,divisor);
//Call the function for display remainder
getch();
return 0;
}
When the above code is executed, it produces the following result
Quotient = 27 Remainder = 10
Program to find quotient and remainder using function – entered by user
The program allows to enter two integer and then the program calculates the quotient and remainder of the given numbers using function in C programming language
Program 2
#include <stdio.h>
#include <stdlib.h>
//user define function for find quotient
void findQuotient(int a, int b){
int Quotient= a/b;
printf("Quotient = %d",Quotient);
}
//user define function for find remainder
void findRemainder(int a, int b){
int Remainder =a%b;
printf("\nRemainder %d",Remainder);
}
int main()
{
int dividend,divisor;
//integer variable declaration
printf("Enter dividend: ") ;
//Ask input from the user for dividend
scanf("%d",÷nd);
//Reading the input
printf("Enter divisor: ") ;
//Ask input from the user for divisor
scanf("%d",&divisor);
//Reading the input
findQuotient(dividend,divisor);
//Call the function for display quotient
findRemainder(dividend,divisor);
//Call the function for display remainder
getch();
return 0;
}
When the above code is executed, it produces the following result
Enter dividend: 2000 Enter divisor: 50 Quotient = 40 Remainder = 0
Program to find quotient and remainder using function – entered by user with return
The program allows to enter two integer and then the program calculates the quotient and remainder of the given numbers using function in C programming language with return
Program 3
#include <stdio.h>
#include <stdlib.h>
//user define function for find quotient
int findQuotient(int a, int b){
return a/b;
}
//user define function for find remainder
int findRemainder(int a, int b){
return a%b;
}
int main()
{
int dividend,divisor;
//integer variable declaration
printf("Enter dividend: ") ;
//Ask input from the user for dividend
scanf("%d",÷nd);
//Reading the input
printf("Enter divisor: ") ;
//Ask input from the user for divisor
scanf("%d",&divisor);
//Reading the input
printf("Quotient = %d",findQuotient(dividend,divisor));;
//Call the function for display quotient
printf("\nRemainder = %d",findRemainder(dividend,divisor));;
//Call the function for display remainder
getch();
return 0;
}
When the above code is executed, it produces the following result
Enter dividend: 1100 Enter divisor: 45 Quotient = 24 Remainder = 20
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