forked from CS816SPE/Learning_Git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalcadd.java
More file actions
43 lines (33 loc) · 1.02 KB
/
calcadd.java
File metadata and controls
43 lines (33 loc) · 1.02 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
42
43
import java,util.Scanner;
public class caladd {
public static vid main(String args[]){
float a, b, res;
char choice, ch;
Scanner scan = new Scanner(System.in)
do {
System.out.print("1.ADD TWO Numbers\n");
System.out.print("2.EXIT\n\n");
System.out.print("Enter Your chice : ");
choice = scan.next().charAt(0);
switch(choice){
case '1' : System.out.print("Enter Two number :")
a = scan.nextFloat();
b = scan.nextFloat();
res = a+b;
System.out.print("Result =" + res);
break;
case '2' : System.exit(0);
break;
case '3' : System.out.print("Enter Two number :")
a = scan.nextFloat();
b = scan.nextFloat();
res = a-b;
System.out.print("Result =" - res);
break;
default : System.out.print("INVALID CHOICE !!!");
break;
}
System.out.print("\n--------------\n");
}while(choice != 2);
}
}