Check Positive numbers using if statement - CSharp Language Basics

CSharp examples for Language Basics:if

Description

Check Positive numbers using if statement

Demo Code

using System;/* www  .  ja  v a2s  .  c o  m*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      // Input
      Console.Write("Enter a number: ");
      string input = Console.ReadLine();
      int number = Convert.ToInt32(input);
      // Evaluation
      if (number > 0)
      {
         Console.WriteLine("The number is positive");
      }
      else
      {
         Console.WriteLine("The number is NOT positive");
      }
   }
}

Result


Related Tutorials