문자열 반복해서 출력하기

SmartBear·2025년 12월 12일

CodingTest

목록 보기
4/30

프로그래머스

문자열 반복해서 출력하기

문제 링크

문제

문자열 str과 정수 n이 주어집니다.
str이 n번 반복된 문자열을 만들어 출력하는 코드를 작성해 보세요.

  • 제한사항
    • 1 ≤ str의 길이 ≤ 10
    • 1 ≤ n ≤ 5
  • 입출력 예
    • 입력 #1

      string 5

    • 출력 #1

      stringstringstringstringstring

코드

using System;

public class Example
{
    public static void Main()
    {
        String[] input;

        Console.Clear();
        input = Console.ReadLine().Split(' ');

        String s1 = input[0];
        int a = Int32.Parse(input[1]);
        
        for (int i = 0; i < a; i++) Console.Write($"{s1}");
    }
}

정답률

정확성: 100.0
합계: 100.0 / 100.0
profile
Python Dev with Infra -> Game Programmer

0개의 댓글