use of abs function in c++ code example
Example 1: abs c++
#include <stdlib.h> /* abs */
int main ()
{
int n,m;
n=abs(23); // n=23
m=abs(-11); // m=11
return 0;
}
Example 2: abs in c++
[Mathematics] |x| = abs(x) [C++ Programming]
Example 3: abs in cpp
int a =4;
int b =5;
int ans = abs(a-b); //ALWAYS RETURN POSITIVE NUMBER.