Sunday, March 2, 2014

If_Else_Statement: (Wk-3), Jan 21, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace If_Else_Statement
{
    class Program
    {
        static void Main(string[] args)
        {
            //Request an integer (positive or negative) from the user
            //Display the statement "Input is valid" when the user input is positive
            //otherwise display the statement "Input is invalid"

            Console.WriteLine("Enter your digit number: ");
            int x = Convert.ToInt32(Console.ReadLine());

            if (x > 0)
            {
                Console.WriteLine("Input is valid");
            }
            else
            {
                Console.WriteLine("Input is invalid");
            }
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment