Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# find biggest number

Tags:

c#

numbers

It's the first time I am using c# so I am not very familiar with it. I would like to create a simple program to find the biggest number if I have the user entering 3 numbers. I just need to know what to put in the code, because I am not very sure.

like image 303
Oliver Avatar asked Feb 25 '11 12:02

Oliver


1 Answers

Use Math.Max:

int x = 3, y = 4, z = 5;
Console.WriteLine(Math.Max(Math.Max(x, y), z));
like image 81
Fredrik Mörk Avatar answered Sep 18 '22 15:09

Fredrik Mörk