Absolute value function
1. Definition: The absolute value of a number gives its positive value. It is defined as |x| = + x if x is positive and - x if x is negative. 2. Example in C language: /* Here is the function to output the absolute value of any number . */ #includeint main() { float value; //Declaring the defined function absolute: float absolute(float value) ; printf("Enter a float -> \n"); scanf ("%f", &value); /*Displaying the entered value*/ printf("The read value is: %6.2f\n", value); /* Displaying its absolute value */ printf("Its absolute value is: %6.2f\n", absolute(value)); return 0; } /*Defininig the function absolute*/ float absolute ( float x ) { if ( x < 0 ) return -x ; else return x ; }