class q3_Abs{ public static void main(String[] args){ int x = -1; int res; if (x >= 0){ //xが0以上(正のとき) res = x; }else{ res = -x; } System.out.println(res); } }
タグ: