-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.java
More file actions
53 lines (36 loc) · 969 Bytes
/
Calculator.java
File metadata and controls
53 lines (36 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package TestProject;
import java.util.Scanner;
public class Calculator {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("Enter Number A: ");
int a=sc.nextInt();
System.out.print("Enter Number B: ");
int b=sc.nextInt();
System.out.println("Choose Your Operation");
System.out.println("1. Addition");
System.out.println("2. Substraction");
System.out.println("3. Multiplication");
System.out.println("4. Divivsion");
System.out.print("Enter Your Opration: ");
int option=sc.nextInt();
int c=0;
switch(option) {
case 1:
c=a+b;
System.out.println("Addition:"+c);
break;
case 2:
c=a-b;
System.out.println("Substraction:"+c);
break;
case 3:
c=a*b;
System.out.println("Multiplication:"+c);
break;
case 4:
c=a/b;
System.out.println("Devision:"+c);
}
}
}