- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcalculator.java
More file actions
Latest commit
20 lines (15 loc) · 653 Bytes
/
Copy pathcalculator.java
File metadata and controls
20 lines (15 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importjava.util.Scanner;
publicclassSimpleCalculator {
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
System.out.print("Enter first number: ");
doublenum1 = scanner.nextDouble();
System.out.print("Enter second number: ");
doublenum2 = scanner.nextDouble();
System.out.println("Addition: " + (num1 + num2));
System.out.println("Subtraction: " + (num1 - num2));
System.out.println("Multiplication: " + (num1 * num2));
System.out.println("Division: " + (num1 / num2));
scanner.close();
}
}