#include <iostream>
using namespace std;
int main(){
int n; cin >> n;
if(n < 0) n = -n;
cout << n << endl;
return 0;
}
直接abs
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n; cin >> n;
cout << abs(n) << endl;
return 0;
}