목록전체글 (206)
gimmickbutreal

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 // 두 정수 A와 B가 주어졌을 때, A와 B를 비교하는 프로그램을 작성하시오. // 첫째 줄에 다음 세 가지 중 하나를 출력한다. // A가 B보다 큰 경우에는 '>'를 출력한다. // A가 B보다 작은 경우에는 '
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); in.close(); System.out.println(A * (B % 10)); System.out.println(A * (B % 100/10)); System.out.println(A * (B / 100)); System.out.println(A * B); } } Colored by Color Scripter cs tip) - in..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // 두 정수 A와 B를 입력받은 다음, A-B를 출력하는 프로그램을 작성하시오. // 첫째 줄에 (A+B)%C, 둘째 줄에 ((A%C) + (B%C))%C, 셋째 줄에 (A×B)%C, 넷째 줄에 ((A%C) × (B%C))%C를 출력한다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); int C = in.nextInt(); System.out.println((A+..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // 두 자연수 A와 B가 주어진다. 이때, A+B, A-B, A*B, A/B(몫), A%B(나머지)를 출력하는 프로그램을 작성하시오. // 첫째 줄에 A+B, 둘째 줄에 A-B, 셋째 줄에 A*B, 넷째 줄에 A/B, 다섯째 줄에 A%B를 출력한다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); System.out.println(A + B); System.out.printl..

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // 두 정수 A와 B를 입력받은 다음, A/B를 출력하는 프로그램을 작성하시오. // 첫째 줄에 A/B를 출력한다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); double a=in.nextDouble(); double b=in.nextDouble(); System.out.print(a/b); in.close(); } } Colored by Color Scripter cs tip) - in.close(); 마지막에 해주기 - nextDouble()은 소수를 나타냄

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // 두 정수 A와 B를 입력받은 다음, AXB를 출력하는 프로그램을 작성하시오. // 첫째 줄에 AXB를 출력한다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); System.out.println(A*B); in.close(); } } Colored by Color Scripter cs tip) - Scanner 패키지는 java.util 패키지에 있기 때문에 java.util.Scanne..

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // 두 정수 A와 B를 입력받은 다음, A-B를 출력하는 프로그램을 작성하시오. // 첫째 줄에 A-B를 출력한다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); System.out.println(A-B); in.close(); } } Colored by Color Scripter cs tip) - Scanner 패키지는 java.util 패키지에 있기 때문에 java.util.Scanne..

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. // 첫째 줄에 A+B를 출력한다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); System.out.println(A+B); in.close(); } } Colored by Color Scripter cs tip) - Scanner 패키지는 java.util 패키지에 있기 때문에 java.util.Scanne..