fork download
  1. // Don't place your source in a package
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. // Please name your class Main
  7. class Main {
  8. public static void main (String[] args) throws java.lang.Exception {
  9. int [] myLotto = new int[7];
  10. System.out.println("김정호 로또 번호 시작 5처넌치");
  11.  
  12. for (int i=0;i<myLotto.length; i++){
  13.  
  14. myLotto [i] = (int) (Math.random() * 45 +1);
  15.  
  16. for (int j = 0; j < i; j++){
  17. if (myLotto[j] == myLotto[i]){
  18. i--;
  19. break;
  20. }
  21. }
  22.  
  23. }
  24.  
  25. for (int i=0;i<myLotto.length-1;i++) {
  26. Arrays.sort(myLotto);
  27. System.out.print(myLotto[i] + " ");
  28.  
  29. }
  30. System.out.println();
  31. for (int i=0;i<myLotto.length; i++){
  32.  
  33. myLotto [i] = (int) (Math.random() * 45 +1);
  34.  
  35. for (int j = 0; j < i; j++){
  36. if (myLotto[j] == myLotto[i]){
  37. i--;
  38. break;
  39. }
  40. }
  41.  
  42. }
  43.  
  44. for (int i=0;i<myLotto.length-1;i++) {
  45. Arrays.sort(myLotto);
  46. System.out.print(myLotto[i] + " ");
  47. }
  48. System.out.println();
  49. for (int i=0;i<myLotto.length; i++){
  50.  
  51. myLotto [i] = (int) (Math.random() * 45 +1);
  52.  
  53. for (int j = 0; j < i; j++){
  54. if (myLotto[j] == myLotto[i]){
  55. i--;
  56. break;
  57. }
  58. }
  59.  
  60. }
  61.  
  62. for (int i=0;i<myLotto.length-1;i++) {
  63. Arrays.sort(myLotto);
  64. System.out.print(myLotto[i] + " ");
  65. }
  66. System.out.println();
  67. for (int i=0;i<myLotto.length; i++){
  68.  
  69. myLotto [i] = (int) (Math.random() * 45 +1);
  70.  
  71. for (int j = 0; j < i; j++){
  72. if (myLotto[j] == myLotto[i]){
  73. i--;
  74. break;
  75. }
  76. }
  77.  
  78. }
  79.  
  80. for (int i=0;i<myLotto.length-1;i++) {
  81. Arrays.sort(myLotto);
  82. System.out.print(myLotto[i] + " ");
  83. }
  84. System.out.println();
  85. for (int i=0;i<myLotto.length; i++){
  86.  
  87. myLotto [i] = (int) (Math.random() * 45 +1);
  88.  
  89. for (int j = 0; j < i; j++){
  90. if (myLotto[j] == myLotto[i]){
  91. i--;
  92. break;
  93. }
  94. }
  95.  
  96. }
  97.  
  98. for (int i=0;i<myLotto.length-1;i++) {
  99. Arrays.sort(myLotto);
  100. System.out.print(myLotto[i] + " ");
  101. }
  102. System.out.println();
  103.  
  104.  
  105.  
  106. // System.out.println("보너스번호:" + myLotto[6]);)
  107. }
  108. }
Success #stdin #stdout 0.1s 55720KB
stdin
Standard input is empty
stdout
김정호 로또 번호 시작 5처넌치
5     8     15     20     21     35     
3     29     34     36     39     43     
4     13     14     20     23     35     
7     13     14     15     33     40     
6     28     34     40     42     44