Guest User

Untitled

a guest
Dec 13th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public class numUnique {
  2. //Create main method.
  3. public static void main(String [] args) {
  4. //Enter the three values.
  5. unique(6, 7, 6);
  6. }
  7. public static int unique(int x, int y, int z) {
  8. //Create if-else statement.
  9. //If all are identical.
  10. if (x == y && x == z) {
  11. System.out.print("1");
  12. return 1;
  13. }
  14. //If all are unique.
  15. else if (x != y && x != z && y != z){
  16. System.out.print("3");
  17. return 3;
  18. }
  19. //If two are the same.
  20. else {
  21. System.out.print("2");
  22. return 2;
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment