CODINGTEST/코딩 기초 트레이닝_C#

[프로그래머스/코딩 기초 트레이닝/C#] 7. 문자열 붙여서 출력하기 / C# 의 출력문 WriteLine

bibiana 각선행 2023. 7. 6. 10:36
반응형

반갑습니다!! 프로그래머스 의 코딩기초 트레이닝을 C# 시작합니다!!

오늘도 따뜻한 하루 되세요~ <3

<문제>

< 풀이 >

 

C# 의 출력문 WriteLine
int newPrice = 3000;
int oldPrice = 2500;

String s1 = String.Format("The new price is {0}. The old one is {1}", newPrice, oldPrice);
Console.WriteLine(s1);

// 실행: The new price is 3000. The old one is 2500
int newPrice = 3000;
int oldPrice = 2500;

Console.WriteLine("The new price is {0}. The old one is {1}", newPrice, oldPrice);

// 실행: The new price is 3000. The old one is 2500

 

 

 

<채점결과>

<정답 코드>

using System;

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

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

        String s1 = input[0];
        String s2 = input[1];
        
        Console.WriteLine(s1+s2);

    }
}

<문제 출처>

https://school.programmers.co.kr/learn/courses/30/lessons/181946

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

함께 즐겨요 코딩 기초 트레이닝<3

반응형