Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class numUnique {
- //Create main method.
- public static void main(String [] args) {
- //Enter the three values.
- unique(6, 7, 6);
- }
- public static int unique(int x, int y, int z) {
- //Create if-else statement.
- //If all are identical.
- if (x == y && x == z) {
- System.out.print("1");
- return 1;
- }
- //If all are unique.
- else if (x != y && x != z && y != z){
- System.out.print("3");
- return 3;
- }
- //If two are the same.
- else {
- System.out.print("2");
- return 2;
- }
- }
- }
Add Comment
Please, Sign In to add comment