Check age range - CSharp Language Basics

CSharp examples for Language Basics:int

Description

Check age range

Demo Code

using System;// w  w w  . java 2s  . com
class DiscountOrNot
{
   public static void Main()
   {
      int age;
      Console.Write("Enter your age: ");
      age = Convert.ToInt32(Console.ReadLine());
      if ((age < 15) || (age > 65))
         Console.WriteLine("Congratulations! You get a discount");
      else
         Console.WriteLine("Sorry no discount for you");
   }
}

Result


Related Tutorials