Untitled

 avatar
unknown
plain_text
a year ago
510 B
4
Indexable
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Enter your age:");
        if (int.TryParse(Console.ReadLine(), out int age))
        {
            if (age >= 18)
            {
                Console.WriteLine("You are 18 or older. OK!");
            }
            else
            {
                Console.WriteLine("Kaboom!");
            }
        }
        else
        {
            Console.WriteLine("Invalid input. Please enter a valid age.");
        }
    }
}
Editor is loading...
Leave a Comment