In this example, you will learn to find the quotient and remainder when an integer is divided by another integer.
Program to Compute Quotient and Remainder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int dividend, divisor, quotient, remainder; | |
printf("Enter dividend: "); | |
scanf("%d", ÷nd); | |
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; | |
} |