Wednesday 27 July 2016

If-Else Demo C Sharp

class Program
    {
        static void Main(string[] args)
        {
            int age;
            Console.WriteLine("Enter your age>> ");
            age = int.Parse(Console.ReadLine());
            if (age > 18)
                Console.WriteLine("Eligible");
            else

            {
                Console.WriteLine("Not Eligible");
            }
            int income;
            Console.Write("Enter your income>> ");
            income=int.Parse(Console.ReadLine());
            if (age > 18 || income > 100)
                Console.WriteLine("Running True Part");
            else
                Console.WriteLine("Running Flase Part");
            if (age < 18 && income < 50)
                Console.WriteLine("Running and true part");
            else
                Console.WriteLine("Running and false part");
        }
    }

No comments:

Post a Comment