-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathRuntime.java
More file actions
50 lines (34 loc) · 862 Bytes
/
Runtime.java
File metadata and controls
50 lines (34 loc) · 862 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.Scanner;
class Runtime{
public static void main(String args []){
Scanner input = new Scanner(System.in);
System.out.print("Enter a first number : ");
int num1= input.nextInt();
System.out.println("Enter a second number : ");
int num2 =input.nextInt();
System.out.println("Enter Any Operation [+,-,*,/] : ");
char ch =input.next( ).charAt(0);
float sum,product,sub,division;
switch(ch)
{
case '+' :
sum=num1+num2;
System.out.print("Sum of two number is : " + sum);
break;
case '-' :
sub=num1-num2;
System.out.print("Sub of number one from number two is : " + sub);
break;
case '*' :
product=num1*num2;
System.out.print("product of two number is : " + product);
break;
case '/' :
division=num1/num2;
System.out.print("Division of number 1 with number 2 is : " + division);
break;
default :
System.out.print("DEfault ");
}
}
}