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,
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
Step by Step Solution
3.47 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
Solution I added an extra function which will convert the given decimal value into sciNotation type ...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