프로그래머스

프로그래머스 - Lv.0 a와 b출력하기

MuscleDeveloper5683 2024. 9. 4. 17:33
728x90
SMALL

 

문제 

 

 

 

 

풀이

 

using System;

public class Example
{
    public static void Main()
    {
        // 1. 사용자로부터 입력받기
        string input = Console.ReadLine();
        
        // 2. 입력된 문자열을 공백을 기준으로 분리하여 배열에 저장
        string[] inputs = input.Split(' ');

        // 3. 각 요소를 정수로 변환
        int a = int.Parse(inputs[0]);
        int b = int.Parse(inputs[1]);

        // 4. 주어진 형식으로 출력
        Console.WriteLine("a = " + a);
        Console.WriteLine("b = " + b);
    }
}

 

728x90