Level1 - 직사각형 별찍기
문제
문제 설명
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.
별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.
제한 조건
- n과 m은 각각 1000 이하인 자연수입니다.
풀이
사용언어 : C#
using System;
public class Example
{
public static void Main()
{
String[] s;
Console.Clear();
s = Console.ReadLine().Split(' ');
int a = Int32.Parse(s[0]);
int b = Int32.Parse(s[1]);
//Console.WriteLine("{0}", a + b);
for (int i = 0 ; i < b; ++ i ){
for (int j = 0 ; j < a; ++ j ){
Console.Write("*");
}
Console.WriteLine("");
}
}
}
출처 : https://programmers.co.kr/learn/courses/30/lessons/12969?language=csharp
'개발 > 프로그래머스' 카테고리의 다른 글
[프로그래머스/C++] 짝수 홀수 풀이 (0) | 2022.11.05 |
---|---|
[프로그래머스/C#] Level1 - 2. x만큼 간격이 있는 n개의 숫자 (0) | 2022.03.11 |
[프로그래머스] Level1 - 45. 직업군 추천하기 (0) | 2021.09.30 |
[프로그래머스] Level1 - 44. 소수 만들기 (0) | 2021.09.29 |
[프로그래머스] Level1 - 43. 모의고사 (0) | 2021.09.28 |