Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TicketCombination {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int input = Integer.parseInt(scanner.nextLine());
- int count = 0;
- int prize = 0;
- for(int a = 'B'; a <= 'L'; a+=2){
- for(int b = 'f'; b >= 'a'; b--){
- for(int c = 'A';c <= 'C'; c++){
- for(int d = 1; d <= 10; d++){
- for(int e = 10; e >= 1; e--){
- count++;
- if(count == input){
- System.out.println("Ticket combination: " + (char)a + (char)b + (char)c + d + e);
- prize = a + b + c + d + e;
- System.out.println("Prize: " + prize + " lv.");
- break;
- }
- }
- if(count == input){
- break;
- }
- }
- if(count == input){
- break;
- }
- }
- if(count == input){
- break;
- }
- }
- if(count == input){
- break;
- }
- }
- scanner.close();
- // "breaks" - are not necessary you can let it roll.....
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement