#include <iostream>
#include <cmath> using namespace std; int main() {
int array[5];
for(int i = 0; i < 5 ; i++) { cin >> array[i]; }
cout<<"Mean value is "<<getMean(array); cout<<"The standard deviation is "<<getStandardDeviation(array); }
float getMean(int array[ ]){
float sum = 0.0, mean;
for(i = 0; i < 5; ++i){ sum += array[i]; } mean = sum/5;
return mean;
}
float getStandardDeviation(int array[ ]){
float variance = 0.0, stdDeviation;
for(i = 0; i < 5; ++i){ variance += pow(array[i] - mean, 2); } variance=variance/5; stdDeviation = sqrt(variance);
return stdDeviation;
}
4. Write a C++ program Write a program that takes as input five numbers and outputs...
Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are X_1, X_2, . X_3, X_4, X_5 then the mean is equal to X = (X_1 + X_2 + X_3+ X_4 + X_5)/5 and the standard deviation is: squareroot (Xl - X)^2 + (X2 - X)^2 + (X3 - X)^2 + (X4 - X)^2 + (X5 - X)^2 Your program must contain at least the following functions:...
Average and Standard Deviation of 4 numbers **c++** Write an input function to input 4 doubles. then write a function that computes the average of 4 doubles and returns the average and the standard deviation. Write a output routine that shows the 6 numbers. Please feel free to use sub-functions to break up your code. you can name the four variables a1, a2, a3, a4, or something equally simple as long as you are consistent. Average (or mean) is...
Please help! We use Java JGrasp. Write a Java program to take the input of 5 numbers and output the mean (average) and standard deviation of the numbers. If the numbers are x1, x2, x3, x4, and x5, the formula for mean is X = (x1 + x2 + x3 + x4 + x5)/5 And the formula for standard deviation is You can also break standard deviation down like this: 1. Work out the Mean (the simple average of the...
(Matlab) Suppose we have a function “hw5f.m” that takes as input x and outputs the value for a function f(x). Write a Matlab program that inputs: • interval [a, b]; • m, the number of data points with evenly spaced nodes from x1 = a to xm = b, and values from f(x); • location z satisfying x2 < z < xm−1, where h = (b − a)/(m − 1); and outputs the value of the interpolaton polynomial using only...
Write a program that takes its input from a file of numbers of type double and outputs the average of the numbers in the file to the screen. The file contains nothing but numbers of type double separated by blanks and/or line breaks. If this is being done as a class assignment, obtain the file name from your instructor C++
write a program that takes a date as input and outputs the date's season. the input is a string to represent the month and an int to represent the day
You must write a C program that prompts the user for two numbers (no command line input) and multiplies them together using “a la russe” multiplication. The program must display your banner logo as part of a prompt to the user. The valid range of values is 0 to 6000. You may assume that the user will always enter numerical decimal format values. Your program should check this numerical range (including checking for negative numbers) and reprompt the user for...
c++ language Write a program that contains the following functions, i. A function isVowel that takes in a character and returns true if it is a vowel and false otherwise ii. A function that request from the user to enter in a sequence of characters, and outputs the number of vowels entered. (Use Function in a) to assist you, a sentinel value can be used to specify the end of the user input iii. A function that reads 3 test...
a) Write a function that takes as input 2 parameters, an array and its size (both ints) and returns the max. Include the driving (main program also. To pass an array to a function, do the following: return_type my_function(int my_array[], int size) b) Write a function that does the above but can contain duplicate numbers and is capable of removing them. Scan in input. Note you may need the sizeof( ) function which is one of the standard libraries.Thus you...
Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH уен Hint: Use the fgets function to read a string with spaces from the user...