-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharithematicOperators.java
More file actions
34 lines (34 loc) · 1.12 KB
/
arithematicOperators.java
File metadata and controls
34 lines (34 loc) · 1.12 KB
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
import java.util.*;
public class arithematicOperators
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Menu");
System.out.println("====");
System.out.println("ADD");
System.out.println("SUB");
System.out.println("MUL");
System.out.println("DIV");
System.out.println("Enter 2 Numbers");
int x= sc.nextInt();
int y= sc.nextInt();
sc.nextLine();
System.out.println("Enter options in Words");
String option=sc.nextLine();
option=option.toUpperCase();
switch(option)
{
case "ADD": System.out.println("Sum is"+(x+y));
break;
case "SUB": System.out.println("Difference is"+(x-y));
break;
case "MUL": System.out.println("Product is"+(x*y));
break;
case "DIV": System.out.println("Ratio is"+(x/y));
break;
default: System.out.println("Invalid Option");
break;
}
}
}