프로그래밍

프로그래머스 C# 직사각형 별찍기(Console.Write, WriteLine)

노마드선샤인 2023. 1. 24. 14:48
728x90

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]);
        for(int j=0;j<b;j++)
        {
            for(int i=0;i<a;i++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }    
    }
}

 

//두 번째 for문이 삼각형이랑 다르게 되어 있다.

728x90