ユーザーに番号を入力するように求める簡単なプログラムを作成しようとしています。次に、その番号を使用して、特定の年齢のチケットの費用を決定します。文字列を int に変換しようとすると問題が発生します。それ以外の場合、プログラムのレイアウトは問題ありません。助言がありますか?ありがとう
using System;
class ticketPrice
{
public static void Main(String[] args)
{
Console.WriteLine("Please Enter Your Age");
int input = Console.ReadLine();
if (input < 5)
{
Console.WriteLine("You are "+input+" and the admisson is FREE!");
}
else if (input > 4 & input < 18)
{
Console.WriteLine("You are "+input+" and the admission is $5");
}
else if (input > 17 & input < 56)
{
Console.WriteLine("You are "+input+" and the admission is $10");
}
else if (input > 55)
{
Console.WriteLine("You are "+input+" and the admission is $8");
}
}
}