프로그래머스 문제

문자열 반복해서 출력하기

nakgopsae 2024. 6. 6. 19:21

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = sc.nextInt();
        String result = "";
        for(int i = 1; i <= n ; i++){
            result += str;
        }
        System.out.println(result);
    }//for 문으로 입력받은 문자를 result에 넣기
}

 

'프로그래머스 문제' 카테고리의 다른 글

덧셈식 출력하기  (0) 2024.06.06
특수 문자 출력하기  (0) 2024.06.06
대소문자 바꿔서 출력하기  (0) 2024.06.05
a와 b 출력하기  (0) 2024.06.05
문자열 출력하기  (0) 2024.06.05