This is what I've tried. My only variable is fVal, and if I entered 5 for fVal when running the program i get this. fVal = 10, fVal = 30, fVal = 120. But it should be 10, 15, 20. See what I mean? If you have more help I'd appreciate it. Thanks!
Code:
#include <stdio.h>
float GetValue()
{
float fVal;
printf("Enter a value for fVal: ");
scanf("%f", &fVal);
return (fVal);
}
void Compute1(float fVal)
{
fVal = fVal * 2;
printf("fVal * 2: %f\n", fVal);
}
void Compute2(float fVal)
{
fVal = fVal * 3;
printf("fVal * 3: %f\n", fVal);
}
void Compute3(float fVal)
{
fVal = fVal * 4;
printf("fVal * 4: %f\n", fVal);
}
int main(void)
{
float GetValue();
void Compute1 ();
void Compute2 ();
void Compute3 ();
float fVal = GetValue();
Compute1();
Compute2();
Compute3();
return(0);
}