Advertisement
damesova

TicketComb - Java

Jan 10th, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. package Exam2829July2018;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TicketCombination {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int number = Integer.parseInt(scanner.nextLine());
  10. int count = 0;
  11.  
  12. for (int i = 66; i <= 76; i+=2) {
  13. for (int j = 102; j >= 97; j--) {
  14. for (int k = 65; k <= 67; k++) {
  15. for (int l = 1; l <= 10; l++) {
  16. for (int m = 10; m >= 1 ; m--) {
  17. count++;
  18. if (count == number) {
  19. System.out.printf("Ticket combination: %c%c%c%d%d%n", (char)i, (char)j, (char)k, l, m);
  20. System.out.printf("Prize: %d lv.", (i+j+k+l+m));
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement