3일차 당신이 입력한 숫자의 합은 ... 입니다.

Console Programming/C# Console 2019. 9. 20. 10:19

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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} 입니다.");
            Console.WriteLine($"당신이 입력한 숫자의 합은 {input1 + input2} 입니다.");
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

input1과 input2의 값을 숫자로 변환하지 않아서

 

55가 아니라 3223이 나옴.

: