22:29

Array

Posted by Mitesh Patel |


import java.util.*;

class ArrayExample{

    public static void main(String args[]) {
        int a[] = new int[5];
        int i;
        int sum = 0;

        for(i=0;i<a.length;i++)
        {
            a[i]  = new Scanner(System.in).nextInt();
            sum = sum + a[i];
        }

       
        System.out.println("Avg = " + (sum/5));




    }
}

0 comments:

Post a Comment

Subscribe