Computer Science, asked by junaidshahid398, 2 months ago

Take 10 integers from keyboard using loop and print their average value on the screen.​

Answers

Answered by amansarrafas24payxgs
6

Answer:

import java.util.*;

class Average

{

public void main()

{

Scanner sc = new Scanner (System.in);

int arr[] = new int[10];

int sum=0, average;

System.out.println("Enter 10 Integers: ");

for(int i = 1;i <= 10;i++)

{

arr[i] = sc.nextInt();

}

for(int j = 1;j <= 10;j++)

{

sum+=arr[j];

}

average = sum/10;

System.out.println("Average of 10 numbers: " + average);

}

}

I hope you find it useful... If you have any query do comment, I will try to solve it...

Similar questions