C Program to Find Division of User Input



Division of two numbers can be calculated using the '/' operator. This returns the quotient value of the division rounded down to the nearest integer.

The given program explains the division of two numbers taken from the user as input.

C Program to Find Division of User Input

The division of two numbers taken as user input is explained in the code given below:

#include <stdio.h>

int main() {
  int x, y;
  
  printf("Enter 2 numbers : ");
  scanf("%d %d", & x, & y);
  
  printf("Quotient of the division is: %d / %d = %d\n", x, y, x / y);
  
  return 0;
}

Output

Output of this program will be −

Enter 2 numbers : 10
3
Quotient of the division is: 10 / 3 = 3
Advertisements