forked from rahul200106/hackoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.java
39 lines (30 loc) · 1.15 KB
/
calculator.java
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
// hacktober 2022 accpected
// hacktober 2022 accpected
import java.util.*;
public class calculator{
public static void main(String agrs[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter First Number : ");
int a = sc.nextInt();
System.out.print("Enter Second Number : ");
int b = sc.nextInt();
System.out.printf("Select 1 For Addition : %n Select 2 For Subtraction : %n Select 3 For Multiplication : %n Select 4 For Division :");
int botton = sc.nextInt();
int d;
switch (botton) {
case 1 : d=a+b;
System.out.println("Your Output is = "+d);
break;
case 2: d=a-b;
System.out.println("Your Output is = "+d);
break;
case 3 : d=a*b;
System.out.println("Your Output is = "+d);
break;
case 4 : d=a/b;
System.out.println("Your Output is = "+d);
break;
default : System.out.println("Invalid button");
}sc.close();
}
}