CSharp examples for Language Basics:if
Check Positive numbers using if statement
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"); } } }