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

[프로그래머스/코딩 기초 트레이닝/C#] 6. 덧셈식 출력하기 / C# 의 출력문 WriteLine

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

반갑습니다!! 프로그래머스 의 코딩기초 트레이닝을 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[] s;

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

        int a = Int32.Parse(s[0]);
        int b = Int32.Parse(s[1]);

        Console.WriteLine("{0} + {1} = {2}",a,b, a + b);
    }
}

<문제 출처>

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

 

프로그래머스

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

programmers.co.kr

https://school.programmers.co.kr/learn/challenges/training?order=recent&languages=csharp

 

코딩 기초 트레이닝 | 프로그래머스 스쿨

프로그래밍 언어를 처음 접하거나 프로그래밍 언어에 익숙해지고 싶다면? 코딩 역량을 탄탄하게 길러주는 코딩 기초 트레이닝으로 차근차근 코딩에 대한 기초 감각을 길러 보세요.

school.programmers.co.kr

 

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

 

반응형