Last active
August 19, 2020 12:03
-
-
Save staffordsmith83/038a6f9964516312368df65b414b51f8 to your computer and use it in GitHub Desktop.
A method that takes three integer numbers and returns the position of the first maximum in the order of the method parameters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static int getNumberOfMaxParam(int a, int b, int c) { | |
int result = 1; | |
if (b > a) { | |
result = 2; | |
if (c > b) { | |
result = 3; | |
} | |
} else if (c > a) { | |
result = 3; | |
} | |
return result; | |
} | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
final int a = scanner.nextInt(); | |
final int b = scanner.nextInt(); | |
final int c = scanner.nextInt(); | |
System.out.println(getNumberOfMaxParam(a, b, c)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment