CS13002 Programming and Data Structures | Section 3/C, Spring 2003--2004 |
Assignment 1
The exercise
Read five positive real numbers a, b, c, d and e from the user and compute their
Arithmetic mean AM = (a + b + c + d + e) / 5 Geometric mean GM = 5th root of abcde Harmonic mean HM = 5 / [ (1/a) + (1/b) + (1/c) + (1/d) + (1/e) ] Standard deviation SD = Square root of [(a2 + b2 + c2 + d2 + e2) / 5 - (AM)2]
Sample output
a = 2.1 b = 3.2 c = 4.3 d = 5.4 e = 6.5 AM = 4.300000 GM = 3.992353 HM = 3.675714 SD = 1.555635
Test input
Show the output of your program on the following two sets of input:Input 1
a = 2 b = 29 c = 541 d = 7919 e = 104729Input 2
a = 148.41315910 b = 54.59815003 c = 20.08553692 d = 7.389056099 e = 2.718281828