-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConditionalStatement.java
More file actions
105 lines (85 loc) · 3.18 KB
/
ConditionalStatement.java
File metadata and controls
105 lines (85 loc) · 3.18 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//import java.util.*;
public class ConditionalStatement {
public static void main(String[] args) {
// int A = 5; // largest of two number
// int B = 10;
// if (A>B) {
// System.out.println("A is the largest amont these two");
// } else{
// System.out.println("B is the largest among these two");
// Scanner sc = new Scanner(System.in); //even and odd
// int number = sc.nextInt();
// if (number % 2== 0 ) {
// System.out.println("Number is Even");
// } else{
// System.out.println("Number is Odd");
// }
// int age = 13; //age
// if (age >=18){
// System.out.println("Adult");
// }else if (age>=13 && age<=18) {
// System.out.println("Teenager");
// }else{
// System.out.println("Child");
// }
// Scanner sc = new Scanner(System.in); //income tax calculator
// int income = sc.nextInt();
// int tax;
// if (income<500000) {
// tax = 0;
// } else if (income>500000 && income<1000000) {
// tax = (int) (income * 0.2);
// }else {
// tax = (int)(income * 0.3);
// }
// System.out.println("your tax is " + tax);
// int a = 1;
// int b = 3;
// int c = 10;
// if ((a >= b) && (a >= c)) {
// System.out.println("Largest number is a");
// }else if ((b >= c)) {
// System.out.println("Largest number is b");
// }else {
// System.out.println("Largest number is c");
// }
// int number = 5; // Ternary operator
// String type = ((number %2) == 0)? "Even" : "Odd";
// System.out.println(type);
// int marks = 80;
// String reportcard = (marks>=33)?"Pass":"Fail";
// System.out.println(reportcard);
// int number = 2; // Switch statement
// switch (number) {
// case 1: System.out.println("pizza");
// break;
// case 2: System.out.println("burger");
// break;
// case 3: System.out.println("mango sake");
// break;
// default: System.out.println("we wake up");
// break;
// }
//Scanner sc = new Scanner(System.in);
// System.out.println("ENTER a");
// int a = sc.nextInt();
// System.out.println("ENTER b");
// int b = sc.nextInt();
// System.out.println("ENTER operator");
// char operator = sc.next().charAt(0);
// switch (operator) {
// case '+' :System.out.println(a+b);
// break;
// case '-' :System.out.println(a-b);
// break;
// case '*' :System.out.println(a*b);
// break;
// case '/' :System.out.println(a/b);
// break;
// case '%' :System.out.println(a%b);
// break;
// default :System.out.println("Operator not excepted");
// break;
// }
}
}