I wrote a function to add two double values:
# include <stdio.h>
double addem(double input1, double input2)
{
double sum ;
sum = input1 + input2 ;
return input1 + input2 ;
}
int main(){
double in1,in2, add = 0 ;
printf("Enter the numbers\n");
scanf("%f", &in1);
scanf("%f", &in2);
/* Calling function */
add = addem(in1, in2);
printf("Sum = %f\n", add);
return 0;
}
However the result always returns a zero:
Enter the numbers
3
3
Sum = 0.000000