본문 바로가기

Java18

[백준][JAVA/자바] 10952번: A+B - 5 브론즈 5 10952번: A+B - 5 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net (1) while 문 조건으로 .hasNextInt() 개념 사용 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); while (s.hasNextInt()) { int a = s.nextInt(); int b = s.nextInt(); if (a == 0 && b == 0) { break; } else { System.out.println(a + b); } } } } (2) while 문 조건으.. 2022. 12. 9.
[백준][JAVA/자바] 10951번: A+B - 4 브론즈 5 10951번: A+B - 4 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); while (s.hasNextInt()) { int a = s.nextInt(); int b = s.nextInt(); System.out.println(a + b); } } } (1) hasNextInt() 2022. 12. 2.
[백준][JAVA/자바] 10950번: A+B - 3 브론즈 5 10950번: A+B - 3 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int caseNum = s.nextInt(); int array[] = new int[caseNum]; for (int i = 0; i < caseNum; i++) { int a = s.nextInt(); int b = s.nextInt(); array[i] = a + b; } for (int i = 0; i < caseNum; i++) { S.. 2022. 12. 1.
[백준][JAVA/자바] 2558번: A+B - 2 브론즈 5 2558번: A+B - 2 첫째 줄에 A, 둘째 줄에 B가 주어진다. (0 < A, B < 10) www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = s.nextInt(); int b = s.nextInt(); System.out.println(a + b); } } 2022. 11. 30.
[백준][JAVA/자바] 1000번: A+B 브론즈 5 1000번: A+B 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = s.nextInt(); int b = s.nextInt(); System.out.println(a + b); } } 2022. 11. 30.
[백준][JAVA/자바] 2557번: Hello World 브론즈 5 2557번: Hello World Hello World!를 출력하시오. www.acmicpc.net public class Main { public static void main(String[] args) { System.out.print("Hello World!"); } } 2022. 11. 30.