Created
April 6, 2017 04:12
-
-
Save Abdujabbar/c21e5ae8be421959763288d9453c2e66 to your computer and use it in GitHub Desktop.
MiniMaxSum
This file contains 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
public class MiniMaxSum { | |
public static void main(String args[]) | |
{ | |
Scanner in = new Scanner(System.in); | |
PrintWriter out = new PrintWriter(System.out); | |
long _max = 0, _min = 1000000000; | |
long sum = 0; | |
long n; | |
for(int i = 0; i < 5; i++) { | |
n = in.nextLong(); | |
sum = sum + n; | |
if (_min > n) { | |
_min = n; | |
} | |
if (_max < n) { | |
_max = n; | |
} | |
} | |
out.println((sum - _max) + " " + (sum - _min)); | |
out.flush(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment