Average is a mathematical term used in taking the appropriate number among the list of numbers. Formula for Average = Sum of all values / No. of values in the list.
There are various scenarios in which we have to say a single value of things. For that instance we use average number for single value. For Eg. If in a batsman scores 20 runs in 1st match, 37 runs in 2nd match and 78 runs in third match. So we can say Average of the batsman is (20+37+78)/3=45. It says that the batsman can score around 45 runs in a match. Here, we can see that we are converting multiple values into single value to make things easier.
So in Conclusion I will be reading three numbers and finding average of them by adding the numbers and then dividing the sum with 3.
Here in this algorithm we declare 4 variables as integers. Three variables for input one variable to store the result. We input two numbers lets say 15 , 20 and 25.In the program we compute average by sum of these numbers i.e.. 15+20+25=60 and dividing it with 3 i.e.. number of values. Therefore the result 20 get stored in avg and at last we print the value.
Our Quiz prepared by Experts Helps you identify your knowledge in Algorithms. Everyone should atleast attempt this Quiz Once.