How to get absolute value from double - c-language
Use fabs
instead of abs
to find absolute value of double
(or float
) data types. Include the <math.h>
header for fabs
function.
double d1 = fabs(-3.8951);
Use fabs()
(in math.h) to get absolute-value for double
:
double d1 = fabs(-3.8951);