Hello!
I'm writing a program that calculates and shows the mean and variance of two integers. The result I'm getting is 7. But that's not the mean of 5 and 10 (num1 and num2). What can I do to show both mean and variance together on the screen? What should I put after return to get both mean and variance?
Thank you.
#include <stdio.h>
double statistics (int x, int y){
double mean, var;
mean = (x+y)/2;
var = ((x-mean)*(x-mean) + (y-mean)*(y-mean)) /2;
return mean;
}
int main(){
int num1, num2;
num1 = 10;
num2 = 5;
printf("%lf", statistics(num1 , num2));
return 0;
}
I'm writing a program that calculates and shows the mean and variance of two integers. The result I'm getting is 7. But that's not the mean of 5 and 10 (num1 and num2). What can I do to show both mean and variance together on the screen? What should I put after return to get both mean and variance?
Thank you.
#include <stdio.h>
double statistics (int x, int y){
double mean, var;
mean = (x+y)/2;
var = ((x-mean)*(x-mean) + (y-mean)*(y-mean)) /2;
return mean;
}
int main(){
int num1, num2;
num1 = 10;
num2 = 5;
printf("%lf", statistics(num1 , num2));
return 0;
}
Comment