using System;
namespace Study00
{
class Program
{
static void Main(string[] args)
{
//입력받습니다.
//정수로 변환
//입력 받습니다.
//정수로 변환
//두 정수의 합을 출력 하세요
//정수의 범위 (-100 ~ 100)
//출력 결과
//a : 10
//b : -2
//sum : 8
while(true)
{
int a = 0;
int b = 0;
int sum = 0;
Console.WriteLine("******************************************************");
Console.WriteLine("두 정수의 합을 출력합니다. 정수 입력 범위 (-100 ~ 100)");
while (true)
{
Console.WriteLine("첫번째 정수를 입력해 주세요.");
a = Convert.ToInt32(Console.ReadLine());
if (-100 <= a && a <= 100)
break;
Console.WriteLine("범위 내의 정수를 입력해 주세요.");
}
while (true)
{
Console.WriteLine("두번째 정수를 입력해 주세요.");
b = Convert.ToInt32(Console.ReadLine());
if (-100 <= b && b <= 100)
break;
Console.WriteLine("범위 내의 정수를 입력해 주세요.");
}
Console.WriteLine("계산 결과");
Console.WriteLine("a : {0}", a);
Console.WriteLine("b : {0}", b);
Console.WriteLine("sum : {0}", sum = a + b);
}
}
}
}