>>scanf ("%d %d %d", &x, &y, &z);
To get doubles use %g or %f. %d is an int.
>>void double get_big(double c, double d, double e)
do you mean void get_big(...) or double get_big(...)
>>get_sum(x, y, z, s);
>>double get_sum(double, double , double, double);
>>double get_sum(double a, double b, double sum) {
You prototype get_sum as taking 4 doubles, and you pass it 4 doubles, but you have the function as taking 3 doubles. You pass s to get_sum, but the value will not change when it returns. You need to pass the address and use a pointer if you want to do it that way. If you just want to return the value then do it like this:
Code:
#include <stdio.h>
double get_sum(double, double, double);
void get_big(double, double, double);
main()
{
double x, y, z,s;
printf ("please enter x y and z"\n)
scanf ("%g %g %g", &x, &y, &z);
s = get_sum(x, y, z);
printf("the sum is %g", s);
get_big(x, y, z);
}
double get_sum(double a, double b, double c)
{
double sum;
return a + b +c
}
void get_big(double c, double d, double e)
{
if (c > d && c > e)
printf ("%g is the biggest\n",c);
if (d > c && d> e)
printf ("%g is the biggest\n",d);
else
printf("%g is the biggest\n",e);
return;
}
>>if (c > d & c > e)
Do you mean
- Sean