Computer Science, asked by toppoking1234, 2 months ago

Write a program in java of size 10 and type integer. Print those elements of the array are larger then

average of the elements of the array.​

Answers

Answered by Mister360
1

Explanation:

Python code:-

# python program to print elements

# which are greater than avg of

# array

# Print array elements greater

# than average

def printAboveAvg(arr, a):

# Find average

avg = 0

for i in range(a):

avg = avg + arr[i]

avg = avg // a

# Print elements greater than

# average

for i in range(a):

if arr[i] > avg:

print(arr[i], end = " ")

# Driver Program

arr = [5, 4, 6, 9, 10]

a = len(arr)

printAboveAvg(arr, a)

# This code is contributed

# by @rian61

Similar questions