5.8k views
1 vote
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

1 Answer

0 votes

Answer:

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

int main()// definition of main function.

{

int Quotient,divisor; // declare the two numbers for operation.

scanf("%d %d",&Quotient,&divisor); // take the user inputs by scanf() function.

printf("The division result of the number = %f",Quotient/divisor);

// print statement to print the division.

return 0; // return statement.

}

Output:

  • If the user input is 10 and 9 then the output is 1.
  • If the user input is 4 and 2 then the output is 2.

Step-by-step explanation:

  • Firstly there is a file inclusion which helps to understand the input and output function
  • Then we declare two variables of integer type which take a value of integer type.
  • Then there is a scanf statement which takes the input from the user. The '%d' format specifies that the value is in an integer value.
  • Then there is a print statement that gives the divisor in floating value. The division operation is written in the printf statement which is used to print the value. '%f' display the value in decimal value.
User Casteurr
by
4.6k points