Hey guys can you show me the right direction?
Code:
#include "stdio.h"
#include "math.h"
float falsepositives(float accuracy, float incidence, float population)
{
return population*(1-incidence)*(1-(accuracy/100));
}
void a2question1()
{
float a,i,f;
int p;
printf("Enter population size: ");
scanf("%d",&p);
printf("Enter the accuracy of the test as a percentage (e.g. 99): ");
scanf("%f",&a);
printf("Enter incidence of the disease as a decimal fraction (e.g. .0001): ");
scanf("%f",&i);
f = falsepositives(a,i,p);
printf("Population = %d, accuracy = %.2f, incidence = %f,\nfalse positives = %.f\n\n",p,a,i,f);
}
float threenumbers(float num1, float num2, float num3)
{
num1=num1+num2+num3;
num2=num1+num2+num3)/3;
num3=num1*num2*num3;
return num1,num2,num3;
}
void a2question2()
{
float a,b,c,s,avg,prod;
printf("Enter a whole number: ");
scanf("%f",&a);
printf("enter a second whole number: ");
scanf("%f",&b);
printf("Enter a third whole number: ");
scanf("%f",&c);
s = threenumbers(a,b,c);
avg = threenumbers(a,b,c);
prod = threenumbers(a,b,c);
printf("Sum = %f\nAverage = %f\nProduct = %f\n\n",s,avg,prod);
}
int main()
{
a2question1();
a2question1();
a2question1();
a2question2();
a2question2();
a2question2();
return 0;
}
I need the program to add,multiply,find the average, the lowest numbers and the highest numbers all in the float functions, but I can't seem to do it, maybe the teacher post the wrong one? Anyway can you guys show me what direction to go, no need to write the cod