0

Hi! This is a real simple and stupid exercise I thought I knew how to handle. The complete heading is:

- Write a function in C whose input is a real number and whose output is the absolute value of the input number.

The following is the code I've developed. It compiles and runs but doesn't do what it is supposed to.

If anyone can point where the error is I would be very grateful.

Thank you in advance.

```
#include <stdio.h>
#include <math.h>
double outputAbsoluteValue (double *number){
*number = fabs(*number);
return *number;
}
void main(){
double myNumber=0.0;
double absValue=0.0;
printf("Enter Real Number: ");
scanf("%f", &myNumber);
absValue=outputAbsoluteValue(&myNumber);
printf("\n Its absolute value is %f", absValue);
fflush(stdin);
getchar();
}
```

*Edited 5 Years Ago by o0OPatriciaO0o*: n/a