#include <stdio.h>
int main() {
int dividend, divisor, quotient, remainder;
printf("Enter dividend: ");
scanf("%d", ÷nd);
printf("Enter divisor: ");
scanf("%d", &divisor);
quotient = dividend / divisor;
remainder = dividend % divisor;
printf("Quotient = %d\n", quotient);
printf("Remainder = %d\n", remainder);
return 0;
}
Enter dividend: 18
Enter divisor: 4
Quotient = 4
Remainder = 2
/
) and the remainder is calculated using the modulus operator (%
). The quotient and remainder are then printed to the console.