Problem
Write a program in C to calculate the quotient and remainder and display it on the screen.
How to compute quotient and remainder in C ?
#include <stdio.h> int main() { // Abundantcode - program to calculate quotient and remainder int dividend, divisor, quotient, rem; printf("Enter dividend: "); scanf("%d", ÷nd); printf("Enter divisor: "); scanf("%d", &divisor); quotient = dividend / divisor; rem = dividend % divisor; printf("Quotient = %d\n", quotient); printf("Remainder = %d", rem); return 0; }
Output
Enter dividend: 8
Enter divisor: 3
Quotient = 2
Remainder = 2
Leave a Reply