fork(7) download
  1. import java.util.*;
  2.  
  3. class AtividadeMegaSena {
  4. public static void main(String[] args) {
  5. Scanner teclado = new Scanner(System.in);
  6. System.out.println("Quantos jogos vocĂȘ quer fazer?");
  7. int numJogos = teclado.nextInt();
  8. List<Integer> numeros = new ArrayList<>();
  9. for (int i = 1; i <= 60; i++) numeros.add(i);
  10. for (int i = 1; i <= numJogos; i++) {
  11. Collections.shuffle(numeros);
  12. for (int j = 0; j < 6; j++) System.out.println(numeros.get(j));
  13. System.out.println();
  14. }
  15. }
  16. }
  17.  
  18. //https://pt.stackoverflow.com/q/386549/101
Success #stdin #stdout 0.06s 2184192KB
stdin
3
stdout
Quantos jogos você quer fazer?
42
2
13
34
19
6

23
5
17
43
34
39

26
10
2
60
19
37