using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
//Accept the number in cmd prompt into a variable and convert it into a string.
//Once done use if..else if and check for the value.
Console.WriteLine("Enter the number : ");
string numFromConsole = Console.ReadLine();
int number = Convert.ToInt32(numFromConsole);
if (number > 0)
{
Console.WriteLine("The number {0} is greater than Zero",
number);
}
else if (number <
0)
{
Console.WriteLine("The number {0} is less than Zero",
number);
}
else
{
Console.WriteLine("The number is a Zero");
}
Console.ReadKey();
}
}
}
No comments:
Post a Comment