C++
#include <iostream>
using namespace std;
int main()
{
int number = 1;
cout << "Input number - ";
cin >> number;
cout << endl;
int abs = 0;
number < 0 ? abs = -number : abs = number;
cout << "Abs(" << abs << ")" << endl;
return 0;
}
Объяснение:
C++
#include <iostream>
using namespace std;
int main()
{
int number = 1;
cout << "Input number - ";
cin >> number;
cout << endl;
int abs = 0;
number < 0 ? abs = -number : abs = number;
cout << "Abs(" << abs << ")" << endl;
return 0;
}
Объяснение: