Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. package plof;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * Dit programma implementeert het "Plof" spel
  7. * @author Martijn van der Meer
  8. */
  9. public class Plof {
  10.  
  11. /**
  12. * @param args the command line arguments
  13. */
  14. public static void main(String[] args) {
  15. Scanner Input = new Scanner(System.in);
  16. //Input voor het plof getal en controle voor juiste waarde
  17. int PLOFGETAL;
  18. do {
  19. System.out.print("Wat is het Plof getal (Moet tussen de 2 en 9 liggen)? ");
  20. PLOFGETAL = Input.nextInt();
  21. } while (PLOFGETAL < 2 ^ PLOFGETAL > 9);
  22.  
  23. //Input voor het maximale getal
  24. System.out.print("Tot en met welk getal moet ik tellen? ");
  25. int MAX = Input.nextInt();
  26.  
  27. //Getallen en plof tonen onder juiste voorwaarden
  28. int GETAL;
  29. for (GETAL = 1; GETAL <= MAX; GETAL ++) {
  30. if (GETAL %PLOFGETAL == 0) {
  31. System.out.print("plof ");
  32. }
  33. else {
  34. System.out.print(GETAL + " ");
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement