Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Globalization;
- namespace _05.TheBiggestOfThreeNumbers
- {
- class TheBiggestOfThreeNumbers
- {
- static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- // First uncommen this:
- //double a = 0;
- //double b = 0;
- //double c = 0;
- //Console.Write("Enter first number a: ");
- //double.TryParse(Console.ReadLine(), out a);
- //Console.Write("Enter second number b: ");
- //double.TryParse(Console.ReadLine(), out b);
- //Console.Write("Enter third number c: ");
- //double.TryParse(Console.ReadLine(), out c);
- // This is the first way to do it:
- //Console.WriteLine("The biggest number is {0}.", (Math.Max(Math.Max(a, b), c)));
- // This is the second way to do it:
- //if ((a > b) && (a > c))
- //{
- // Console.WriteLine(a);
- //}
- //else
- //{
- // if ((b > a) && (b > c))
- // {
- // Console.WriteLine(b);
- // }
- // else
- // {
- // Console.WriteLine(c);
- // }
- //}
- // This is the third way to do it:
- double max = double.MinValue;
- for (double i = 0; i < 3; i++)
- {
- double num = double.Parse(Console.ReadLine());
- if (num > max)
- {
- max = num;
- }
- }
- Console.WriteLine(max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement