프로그래머스코딩테스트기초3 프로그래머스 대소문자 바꿔서 출력하기 자바 [기초] - 문제 설명에서 캐치해야할 포인트 1. 문자열 str 2. 대문자는 소문자로, 소문자는 대문자로 변환 3. 출력하는 코드 작성 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String answer = ""; for(int i = 0; i < a.length(); i++){ char b = a.charAt(i); if(Character.isLowerCase(b)){ answer += Character.toUpperCase(b); } else { answer += Character.to.. 2024. 1. 12. 프로그래머스 문자열 반복해서 출력하기 자바 [기초] import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int n = sc.nextInt(); for (int i=0; i 2024. 1. 11. 프로그래머스 a와 b 출력하기 자바 [기초] import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); System.out.println("a = " + a); System.out.println("b = " + b); } } 처음에는 println(a); println(b); 라고 작성했는데 오류가 떴다. 그래서 내가 뭘 놓친거지 싶다가 역시 오늘도 나의 바보력에 놀랐다. 하.... System.out.println("문자열"); System.out.println(변수명); System.out.print.. 2024. 1. 10. 이전 1 다음