C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C++ Math fabs()It computes the absolute value of a given number. Suppose a number is 'x': fabs(x) = |x|; Syntaxfloat fabs(float x); double fabs(double x); int fabs(int x); Parameterx: The value whose absolute value is to be determined. Return valueIt returns the absolute value of x. Example 1Let's see the simple example when the value of x is positive. #include Output: Value of x is :11.2 Absolute value of x is : 11.2 In this example, fabs() function determines the absolute value of x=11.2. Example 2Let's see the simple example when the value of x is negative. #include Output: Value of x is :-9.4 Absolute value of x is : 9.4 In this example, fabs() function computes the absolute value of x when the value of x is equal to -9.4.
Next TopicC++ Math Functions
|