Answers for "absolute value in c++\"

C++
3

abs in c++

#include <cmath>
abs(number);
Ex: abs(-10) = |-10| = 10
Posted by: Guest on June-05-2021
0

c++ absolute value

#include <stdio.h>      /* printf */
#include <stdlib.h>     /* abs */

int main ()
{
  int n,m;
  n=abs(23);
  m=abs(-11);
  printf ("n=%d\n",n);
  printf ("m=%d\n",m);
  return 0;
}
Posted by: Guest on March-26-2022
0

abs in c++ used for

//abs() returns the absolute value of an integer number.
double a {-5000};
std::cout << "Result : " << std::abs(a) << std::endl;
Posted by: Guest on April-28-2022

Browse Popular Code Answers by Language