Computer Science, asked by BastavBoruah, 8 months ago

write a c program that accept two numbers from user and print their quotient and remainder ?

Answers

Answered by kaushalprakash1289
2

Answer:

Program to find Quotient and Remainder

In this program, user is asked to enter the dividend and divisor and the program then finds the quotient and remainder based on the input values.

#include <stdio.h> int main(){ int num1, num2, quot, rem; printf("Enter dividend: "); scanf("%d", &num1); printf("Enter divisor: "); scanf("%d", &num2); /* The "/" Arithmetic operator returns the quotient * Here the num1 is divided by num2 and the quotient * is assigned to the variable quot */ quot = num1 / num2; /* The modulus operator "%" returns the remainder after * dividing num1 by num2. */ rem = num1 % num2; printf("Quotient is: %d\n", quot); printf("Remainder is: %d", rem); return 0; }

Output:

Enter dividend: 15 Enter divisor: 2 Quotient is: 7 Remainder is: 1

Similar questions