Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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?
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.print("How many numbers do you wanna input? ");
- ulige(in.nextInt());
- }
- public static void ulige(int input) {
- Scanner in = new Scanner(System.in);
- //input of numbers from user
- int række = 1;
- while (række <= input) {
- System.out.print("Nummer " + række + ": ");
- in.nextInt();
- række++;
- }
- //Amount of unequal numbers
- if (input % 2 == 0) {
- System.out.println("Amount of unequal numbers is : ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement