Here is source code of the C# Program to Accept a Number from the user and Display it if it is Positive. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
* C# Program to Accept a Number from the user and Display it
* if it is Positive
public static void Main(string args)
Console.WriteLine("Enter a number: ");
int number = Convert.ToInt32(Console.ReadLine());
if (number > 0)
Console.WriteLine("Number is positive");
else if (number == 0)
Console.WriteLine("Number is 0");
Console.WriteLine("Number is negative");
Here is the output of the C# Program:
Enter a Number : -4 Number is Negative
Sanfoundry Global Education & Learning Series – 1000 C# Programs.