Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args){
- Scanner ss = new Scanner(System.in);
- int[] arr = new int[5];
- int[] arr1= new int[5];
- for(int i =0; i<5;i++){
- arr[i] = ss.nextInt();
- }
- for(int i=0; i<5;i++){
- for(int j=0; j<5; j++){
- if( j != i){
- arr1[i] += arr[j];
- }
- }
- }
- long minsum =arr1[0] , maxsum=arr1[0];
- for(int i =0; i<5;i++){
- if(minsum>arr1[i]){
- minsum = arr1[i];
- }
- if(maxsum<arr1[i]){
- maxsum = arr1[i];
- }
- }
- System.out.println(minsum + " " + maxsum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement