In this Program the user is asked to enter two numbers. Based on the numbers the division of two numbers is per Algorithm: Step 1: Start. Step 2: Declare variables, say a, b and c. Step 3: c = a/b; Step 4: Display result. Step 5: Stop. Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
import java.util.Scanner; class Division { public static void main(String args[]) { int num1; int num2; float result; System.out.println("\n \n *** www.programmingposts.com *** \n \n"); System.out.println("<< JAVA Program for division Two Integers >> \n \n"); Scanner scanner = new Scanner(System.in); System.out.println("Enter first number:"); num1 = scanner.nextInt(); System.out.println("Enter Second number:"); num2 = scanner.nextInt(); result = num1 / num2; System.out.println("The division of two numbers is:" +result); } } |
… Continue Reading Java program for Division of two numbers