C Programming - Standard Scientific Notation: A real number, n, can be written in standard scientific notation
Question:
C Programming - Standard Scientific Notation: A real number, n, can be written in standard scientific notation if it is represented by its mantissa, m, and its exponent, e. The mantissa is a real number between 1 and 10 (zero cannot be represented with this notation) whereas the exponent is an integer number indicating the power of 10 that needs to be multiplied with m to obtain n. Write a C program that:
1. Asks the user to enter up to 10 real valued numbers from the keyboard. The number of values to be entered is defined by the user.
2. Converts the entered values to the standard scientific notation. A structure sciNotation is used to store the mantissa and the exponent of each value. The structure is defined as follows:
typedef struct {
double mantissa;
int exponent;
} sciNotation;
3. Stores the numbers entered by the user in an array of type sciNotation
4. Displays the mean value of all numbers entered. The mean value is computed by a function that receives as an argument the array that contains the numbers in scientific notation and the array length and returns the mean value in scientific notation. The following funcion declarations shall be used:
sciNotation meanVal(sciNotation arr[], int len)
void printVal(sciNotation *num) // displays a number in scientific notation
Sample run:
Enter the number of values you wish to process: 4
Enter a value: 35000
Enter a value: 5464.34
Enter a value: 0.002465
Enter a value: 567432.1
Values entered: 3.5E+4
5.46434E+3
2.465E-3
5.674321E+5
Mean value: 1.440991E+5
Elementary Statistics A Step By Step Approach
ISBN: 978-1259755330
10th edition
Authors: Allan G. Bluman