3일차 당신이 입력한 숫자는 "32", "23"입니다. (숫자에 큰(작은)따옴표 표시)

Console Programming/C# Console 2019. 9. 20. 10:35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax05
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("*** 0보다 크고 100보다 작은 숫자 두개를 입력하고 출력 하기 ***");
            Console.Write("첫번째 숫자를 입력 해주세요.");
            string input1 = Console.ReadLine();
            Console.Write("두번째 숫자를 입력해주세요.");
            string input2 = Console.ReadLine();
 
            Console.WriteLine($"당신이 입력한 숫자는 \"{input1}\", \"{input2}\" 입니다.");
 
            int ConvertedVal1 = Int32.Parse(input1);
            int ConvertedVal2 = Int32.Parse(input2);
 
            Console.WriteLine($"당신이 입력한 숫자의 합은 \"{ConvertedVal1+ConvertedVal2}\" 입니다.");
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

input1 이라는 값에 "가 붙어서 출력되려면 "를 그냥 쓰는 것이 아니라 \" 형태로 사용한다. 

 

마찬가지로 작은 따옴표 '를 출력하려면 \'를 사용하면 된다.

 

숫자 앞뒤로 큰따옴표를 표시
숫자 앞뒤로 작은 따옴표를 표시
: