Computer Science, asked by fiza1955, 11 months ago

4) Write a C Program to display Quotient and Remainder of division of two variable.​

Answers

Answered by charlie1505
6

Answer:

#include <stdio.h>

int main(){

int dividend, divisor, quotient, remainder;

printf("Enter dividend: ");

scanf("%d", &dividend);

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;

}

Explanation:

In this program, user is asked to enter two integers (dividend and divisor) which is stored in variable dividend and divisor respectively.

Then the quotient is evaluated using division / operator and stored in variable quotient.

Similarly, the remainder is evaluated using modulus % operator and stored in remainder variable.

Finally, the quotient and remainder are displayed using printf() function.

Similar questions