Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Sort_Three_Numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- double firstNum = double.Parse(Console.ReadLine());
- double secondNum = double.Parse(Console.ReadLine());
- double thirdNum = double.Parse(Console.ReadLine());
- double maxValue = 0;
- double minValue = 0;
- double middleValue = 0;
- maxValue = Math.Max(Math.Max(firstNum, secondNum), thirdNum);
- minValue = Math.Min(Math.Min(firstNum, secondNum), thirdNum);
- if (maxValue == firstNum || maxValue == secondNum)
- {
- if (minValue == firstNum || minValue == secondNum)
- {
- middleValue = thirdNum;
- }
- }
- if (maxValue == firstNum || maxValue == thirdNum)
- {
- if (minValue == firstNum || minValue == thirdNum)
- {
- middleValue = secondNum;
- }
- }
- if (maxValue == secondNum || maxValue == thirdNum)
- {
- if (minValue == secondNum || minValue == thirdNum)
- {
- middleValue = firstNum;
- }
- }
- Console.WriteLine($"{maxValue} {middleValue} {minValue}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment