forked from Haresh1204/Algorithms
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCal.java
More file actions
Latest commit
41 lines (36 loc) · 1.13 KB
/
Copy pathCal.java
File metadata and controls
41 lines (36 loc) · 1.13 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
35
36
37
38
39
40
41
importjava.util.Scanner;
publicclassCal
{
publicstaticvoidmain(Stringargs[])
{
inti,a,b;
Scannerinput=newScanner(System.in);
System.out.println("1.addition 2.substraction 3.multiplextion 4.division ");
System.out.print("enter your choice:");
i=input.nextInt();
System.out.print("enter number a:");
a=input.nextInt();
System.out.print("enter number b:");
b=input.nextInt();
switch(i)
{
case1:floatadd;
add=a+b;
System.out.println("addition of two number is: " +add);
break;
case2:floatsub;
sub=a-b;
System.out.println("substraction of two number is: " +sub);
break;
case3:floatmul;
mul=a*b;
System.out.println("multiplextion of two number is: " +mul);
break;
case4:floatdiv;
div=a/b;
System.out.println("division of two number is: " +div);
break;
default:System.out.println("please enter a valied choice!..");
}
}
}