Notice
Recent Posts
Recent Comments
Link
스토리지
[3.10] - 제한된 범위 내에서 두 정수의 합 본문
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Study01
{
class Program
{
static void Main(string[] args)
{
Console.Write("정수 입력 : ");
string tmp1 = Console.ReadLine();
Console.Write("정수 입력 : ");
string tmp2 = Console.ReadLine();
int t1 = Convert.ToInt32(tmp1);
int t2 = Convert.ToInt32(tmp2);
if (Math.Abs(t1) > 100 && Math.Abs(t2) > 100)
{
Console.WriteLine("범위를 벗어났습니다.");
}
else
{
Console.WriteLine("sum : {0}", t1 + t2);
}
}
}
}
'Unity > 수업내용(C#)' 카테고리의 다른 글
[3.10] 콘솔창 색 바꾸기 (번외) (0) | 2021.03.10 |
---|---|
[3.10] 구구단 출력 (0) | 2021.03.10 |
[3.10] 종족 선택 - enum 및 switch분기 (0) | 2021.03.10 |
[3.10] 구구단 응용 - 점프문 (0) | 2021.03.10 |
[3.10] 캐릭터 선택 - switch분기 (0) | 2021.03.10 |
Comments