C Program to Find Quotient and Remainder of Two Integers
ADVERTISEMENTS
C program to find quotient and remainder of two integers. In this article, you will learn how to find quotient and remainder of two integers in c language.
Source Code
// C Program to Find Quotient and Remainder of Two Integers
#include <stdio.h>
int main() {
int dn, dr, qu, rem;
// dn - denotes the dividend
// dr - denotes the divisor
// qu -denotes the Quotient
// rem - denotes the remainder
printf("-----Enter the dividend & divisor to compute the quotient and remainder-----\n");
scanf("%d%d", &dn, &dr);
qu = dn / dr; // Computes the quotient
rem = dn % dr; // Computes the remainder
printf("\n\nThe Quotient is %d\n", qu);
printf("The Remainder is %d\n", rem);
return 0;
}
Output
-----Enter the dividend & divisor to compute the quotient and remainder-----
31
5
The Quotient is 6
The Remainder is 1