C++ Program to find absolute value of long and float number


In this Program, You will learn how to find the absolute value of long and float number in C++.


Find absolute in C++

long x=abs(-390090);


Example: How to find absolute value of long and float number in C++

Run it Now
#include<iostream>
#include<math.h>
using namespace std;

int main() {

   long x = -200039;
   float y = -239.55f;

   x = abs(x);
   y = abs(y);
   cout << "Long abolute value is :" << x << endl;
   cout << "Float absolute value is :" << y;

   return 0;
}

Output:

Long abolute value is :200039
Float absolute value is :239.55