Jacob_Thomas

Untitled

Jun 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3. class arrayupdate
  4. {
  5.     public static void main()throws IOException
  6.     {
  7.         try
  8.         {
  9.             Scanner sc=new Scanner(System.in);
  10.             int n=sc.nextInt();
  11.             int arr[]=new int[n];
  12.             int sum=0;
  13.             for(int x=0;x<n;x++)
  14.             {
  15.                 arr[x]=sc.nextInt();
  16.                 sum+=arr[x];
  17.             }
  18.             int div=(int)sum/n;
  19.             div+=1;
  20.             System.out.println(div);
  21.         }
  22.         catch(Exception e)
  23.         {
  24.             System.out.println("ERROR");
  25.         }
  26.     }
  27. }
Add Comment
Please, Sign In to add comment