Computer Science, asked by rodriguezmayela20, 11 months ago

Write a program that prompts the user to input two numbers, a numerator and a divisor. Your program should then divide the numerator by the divisor, and display the quotient and remainder.

Answers

Answered by charlie1505
0

Answer:

#include <stdio.h>

int main(){

int numerator, divisor, quotient, remainder;

printf("Enter numerator: ");

scanf("%d", &numerator);

printf("Enter divisor: ");

scanf("%d", &divisor);

// Computes quotient

quotient = numbers / divisor;

// Computes remainder

remainder = dividend % divisor;

printf("Quotient = %d\n", quotient);

printf("Remainder = %d", remainder);

return 0;

}

Answered by AskewTronics
0

Below are the program for the above problem defined in c language--

Explanation:

#include <stdio.h>// inclusion of header file

int main()// definition of main function

{

   int number1,number2; // define two numbers

   scanf("%d %d",&number1,&number2); // take the user inputs for two numbers

   printf("The Quotient of the number is = %d and The Remainder of the number is=%d",number1/number2,number1%number2); // print statement to print the quotient and remainder.

   return 0; // return statement

}

Output:

  • If the user inputs are 10 and 9 then the result are "The Quotient of the number is = 1 and The Remainder of the number is=1".
  • If the user inputs are 11 and 10 then the result are "The Quotient of the number is = 1 and The Remainder of the number is=1".

Code explanation:

  • Firstly we declare two variables of type integer and takes the input of that variable by the help of scanf() function.
  • Then the Quotient and the remainder of the number are print with the help of print function by performing the calculation. (division operator(/) is used to give the quotient and modulo (%) operator is used to give the remainder of a number.)

Learn More:

  • Definition of C Program: brainly.in/question/3999878
Similar questions