Create the following program using C language in Microsoft Visual Studios:
Create a program that uses a function that will print to the user the mean, high value, and low value of 5 input values into your function. The output of the function should pass the mean.
#include <stdio.h> double mean_high_low(int n1, int n2, int n3, int n4, int n5) { double mean = (n1 + n2 + n3 + n4 + n5) / 5.0; int min = n1, max = n1; if (n2 > max) max = n2; if (n3 > max) max = n3; if (n4 > max) max = n4; if (n5 > max) max = n5; if (n2 < min) min = n2; if (n3 < min) min = n3; if (n4 < min) min = n4; if (n5 < min) min = n5; printf("Min is %d\n", min); printf("Max is %d\n", max); printf("Mean is %lf\n", mean); return mean; } int main() { int n1, n2, n3, n4, n5; printf("Enter 5 numbers: "); scanf("%d", &n1); scanf("%d", &n2); scanf("%d", &n3); scanf("%d", &n4); scanf("%d", &n5); mean_high_low(n1, n2, n3, n4, n5); return 0; }
Get Answers For Free
Most questions answered within 1 hours.