1#include <iostream>
2#include <cstdlib>
3using namespace std;
4
5int main()
6{
7 int x = -5;
8 long y = -2371041;
9
10 int a = abs(x);
11 long b = abs(y);
12
13 cout << "abs(" << x << ") = |" << x << "| = " << a << endl;
14 cout << "abs(" << y << ") = |" << y << "| = " << b << endl;
15}
16
17/* output
18abs(-5) = |-5| = 5
19abs(-2371041) = |-2371041| = 2371041*/
1val1 = abs(22);
2val2 = abs(-43);
3
4cout << "abs(22) = " << val1 << "\n";
5cout << "abs(-43) = " << val2 << "\n";