CSharp examples for Language Basics:Math
Use Math.Max to get the bigger value
using System;//from w ww . j a va 2s . c o m using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { // Inputs Console.Write("Enter first number: "); string input1 = Console.ReadLine(); int number1 = Convert.ToInt32(input1); Console.Write("Enter second number: "); string input2 = Console.ReadLine(); int number2 = Convert.ToInt32(input2); // Evaluating int greater = Math.Max(number1, number2); // Output Console.WriteLine("Greater of entered numbers is: " + greater); } }