-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathifCondition.java
66 lines (52 loc) · 1.94 KB
/
ifCondition.java
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
import java.util.Scanner;
public class ifCondition {
public static void main(String[]args){
// Scanner scanInput= new Scanner(System.in);
//if else
// int age=scanInput.nextInt();
// if(age>20){
// System.out.println("you can drink alcohol product");
// }
// else{
// System.out.println("You cannot dirnk the alcohol.");
// }
//if else if
// System.out.println("Enter mark for given subjects.");
// System.out.print("Math: ");
// int marksMath=scanInput.nextInt();
// System.out.print("English: ");
// int marksEnglish=scanInput.nextInt();
// System.out.print("Social: ");
// int marksSocial=scanInput.nextInt();
// double percentage=(marksEnglish+marksMath+marksSocial)/3;
// if(90 <= percentage && percentage>=100){
// System.out.println("You got S grade.");
// }
// else if(80 <= percentage && percentage>90){
// System.out.println("You got A grade.");
// }
// else if(70 <= percentage && percentage>80){
// System.out.println("You got B grade.");
// }
// else if(60 <= percentage && percentage>70){
// System.out.println("You got B grade.");
// }
// else{
// System.out.print("Undefine");
// }
//nested if
String username="anish";
int pin=1234;
if(username=="anish"){
if(pin==1234){
System.out.println("Welcome "+username);
}
else{
System.out.println("your pin was incorrect.");
}
}
else{
System.out.println("your username was incorrect.");
}
}
}