-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathor.java
43 lines (24 loc) · 767 Bytes
/
or.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
import java.util.Scanner;
class or{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
System.out.println("enter ther passwd");
int passwd=sc.nextInt();
System.out.println("r-enter the password");
int passwdr=sc.nextInt();
int totalAttempts=sc.nextInt();
while (totalAttempts == 0) {
if (passwd == passwdr) {
System.out.println("Login Correct!");
return;
} else {
System.out.println("Incorrect Login");
totalAttempts--;
System.out.println(totalAttempts);
}
}
if (totalAttempts == 0) {
System.out.println("Maximum number of attempts exceeded");
}
}
}