-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment1.java
More file actions
28 lines (25 loc) · 1010 Bytes
/
Assignment1.java
File metadata and controls
28 lines (25 loc) · 1010 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
import java.util.Scanner;
class Assignment1{
public static void main(String[] args)
{ boolean exit=false;
Scanner sc= new Scanner(System.in);
System.out.println("Enter 2 no for Operation");
double num1=sc.nextDouble();
double num2=sc.nextDouble();
while(!exit)
{
System.out.println("\nEnter Your choice \n 1. Add 2.sub");
int choice = sc.nextInt();
switch(choice)
{
case 1:System.out.printf("Sum is"+(num1+num2));
break;
case 2:System.out.printf("Sub is"+(num1-num2));
break;
case 3: exit=true;
default: System.out.print("Invalid choice");
}
}
sc.close();
}
}