Java 代码
import java.util.Scanner;
public class Main
{
public static int abs (int n)
{
if (n < 0)
return n * -1;
else
return n;
}
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
System.out.println (abs (n));
}
}