Advertisement
yovkovbpfps

EXAM 28-29 JULY 2017 06.Ticket Combination

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