using System;
namespace MyFirstProgram
{
internal class Program
{
static void Main(string[] args) // main method
{
// if 조건문
Console.WriteLine("Please enter your age: ");
int myAge = Convert.ToInt32(Console.ReadLine());
if (myAge > 100)
{
Console.WriteLine("You are too old to sign up!");
}
else if (myAge < 0)
{
Console.WriteLine("You haven't been born yet!");
}
else if (myAge >= 18)
{
Console.WriteLine("You are now signed up");
}
else
{
Console.WriteLine("You must be 18+ to sign up!");
}
}
}
}
728x90
'언어 > [C#]' 카테고리의 다른 글
[C#] 논리연산자 && (and), || (or) (0) | 2023.03.01 |
---|---|
[C#] switch 문 switch - case (0) | 2023.03.01 |
[C#] String 함수 ToUpper(), ToLower(), Replace(), Insert(), Length, Substring() (0) | 2023.03.01 |
[C#] 피타고라스 정리 (hypotenuse) (0) | 2023.03.01 |
[C#] 랜덤 Random (Random.Next(), Random.NextDouble()) (0) | 2023.02.25 |