Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. I've asked the user to input a bunch of integers. Now I wanna find how many of those integers the user entered are unequal numbers. How can I do that?
  2.  
  3.  
  4.  
  5.  
  6. public static void main(String[] args) {
  7. Scanner in = new Scanner(System.in);
  8.  
  9. System.out.print("How many numbers do you wanna input? ");
  10. ulige(in.nextInt());
  11.  
  12. }
  13.  
  14. public static void ulige(int input) {
  15. Scanner in = new Scanner(System.in);
  16.  
  17. //input of numbers from user
  18. int række = 1;
  19. while (række <= input) {
  20. System.out.print("Nummer " + række + ": ");
  21. in.nextInt();
  22. række++;
  23. }
  24.  
  25.  
  26. //Amount of unequal numbers
  27. if (input % 2 == 0) {
  28. System.out.println("Amount of unequal numbers is : ");
  29.  
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement