latest Post

C# Program to Accept a Number from the user and Display it if it is Positive

using System;
 class program
{
 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");
 }
 else
{
Console.WriteLine("Number is negative");
}
 Console.ReadLine();
}
}

 Here is the output of the C# Program:
 Enter a Number : 7 Number is positive

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment