양수변환
-
Java - If문을 이용한 음수를 양수로 변환개발노하우/Java 2007. 4. 18. 13:00
import java.io.*; public class Putint{ public static void main(String[] arg)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String x = ""; int a = 0; x = in.readLine(); a = Integer.parseInt(x); if(a>0) { System.out.println("x="+a); } else { a=a*-1; System.out.println("x="+a); } } }