In: Computer Science
Complete the following Java code. Compute the average of all the numbers in nums and store it in a variable called average
public static void main(String[] args){
int[] nums = <some array values>;
Screenshot :-

Code:-
public class Main
{
   public static void main(String[] args) {
       int[] nums = {3,4,8,9,7};
       float avg=0;
         
       for(int
i=0;i<nums.length;i++)
       avg=avg + nums[i];
      
       avg= avg/nums.length;
         
       System.out.println("The average is
:" + avg);
   }
}