'how to use IF else inside Do while loop [closed]
I want to Make a game Enter ATM pin with only 5 chances if you guess the correct pin it will stop automatic, and if Chances = 0 it will stop also,
int answer, chances = 5;
do{
Scanner scan = new Scanner(System.in);
System.out.print("Enter your Bank ATM pin : ");
answer= scan.nextInt();
chances--;
}while(chances > 0);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|