Question
C programming calculates the mean, median and mode of a given array in the following manner: Write three functions mean (), median () and mode
C programming
calculates the mean, median and mode of a given array in the following manner: Write three functions mean (), median () and mode () that calculates the mean, median and mode of an array. Using these functions write a program that calculates all the three above mentioned values for two different arrays A and B where A is an array that contains the number of hours spent by a person each day for playing video games and B is an array that contains the number of hours spent by a person each day for his studies. Based on the above-mentioned values that you calculate using these functions compare the values obtained from both the arrays. If all the three values of array A is greater than array B print statement that warns the person to study. If all the three values of array B is greater than array A print statement that praises him for his studies. If all the three values are equal print statement that tells him he is well balanced. If any other issues, print Sorry cant come to an outcome. Example: Let array A be: 4 5 5 2 8 9 Let array B be: 2 3 1 4 8 4 Mean of A is: 5.5 Median of A is: (5+2)/2=3.5 Mode of A is: 5 Mean of B is: 3.6 Median of B is: (1+4)/2=2.5 Mode of B is: 4 Here Mean, Median and Mode of A is larger than B. Therefore, we print Youre playing more video games you have to spent more time studying. In case if Mean, Median and Mode of A is lesser than B then you print Great, youre spending considerable time in studying.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started