**Division in Java:**

This article will show you the process to divide in Java with output.

Division is one of the basic operations in java. Other include addition, subtraction, and multiplication. For dividing in java, a division ** operator **(

**/**)is used. This operator takes two operands(the natural numbers to be divided) to divide them.

We will see two ways for java division:**First **by declaring the number to be divided inside the program.**Second **by taking the user input.

### 1. Program: division source code in java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public class DivisionJava { public static void main(String[] args) { //declaring operands float num1 = 70, num2 = 3; //division float result = num1/num2; //Display System.out.println("The result is: "+result); } } |

**The output** of the division in java:

1 | The result is: 23.333334 |

### 2. Program: division taking user input.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import java.util.Scanner; public class JavaDivision { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("Enter the first number (Denominator): "); int num1 = input.nextInt(); System.out.print("Enter the second number (Numerator): "); int num2 = input.nextInt(); //Division int result = (num1/num2); System.out.println("\nThe result of division is:" +result); } } |

**The output** of the user input division in Java:

1 2 3 4 | Enter the first number (Denominator): 70 Enter the second number (Numerator): 3 The result of division is:23.333334 |