IDNLearn.com provides a seamless experience for finding and sharing answers. Get comprehensive and trustworthy answers to all your questions from our knowledgeable community members.

Write an algorithm to calculate the average
value of array of integer elements


Sagot :

Answer:

Explanation: Input : arr[] = {1, 2, 3, 4, 5}

Output : 3

Sum of the elements is 1+2+3+4+5 = 15

and total number of elements is 5.

So average is 15/5 = 3

Input : arr[] = {5, 3, 6, 7, 5, 3}

Output : 4.83333

Sum of the elements is 5+3+6+7+5+3 = 29

and total number of elements is 6.

So average is 29/6 = 4.83333.

Thank you for using this platform to share and learn. Don't hesitate to keep asking and answering. We value every contribution you make. Thank you for trusting IDNLearn.com. We’re dedicated to providing accurate answers, so visit us again for more solutions.