Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("A:");
- double A = double.Parse(Console.ReadLine());
- Console.WriteLine("B:");
- double B = double.Parse(Console.ReadLine());
- Console.WriteLine("C:");
- double C = double.Parse(Console.ReadLine());
- SortInc3_2(ref A, ref B, ref C);
- Console.WriteLine($"\n{A}\n{B}\n{C}");
- }
- static void SortInc3(ref double A, ref double B, ref double C)
- {
- double min = Math.Min(A, Math.Min(B, C));
- double max = Math.Max(A, Math.Max(B, C));
- double mid = 0d;
- if (A != min && A != max) mid = A;
- if (B != min && B != max) mid = B;
- if (C != min && C != max) mid = C;
- A = min;
- B = mid;
- C = max;
- }
- static void SortInc3_1(ref double A, ref double B, ref double C)
- {
- List<double> list = new List<double>();
- list.Add(A);
- list.Add(B);
- list.Add(C);
- list.Sort();
- A = list[0];
- B = list[1];
- C = list[2];
- }
- static void SortInc3_2(ref double A, ref double B, ref double C)
- {
- double[] arr = new double[3];
- arr[0] = A;
- arr[1] = B;
- arr[2] = C;
- Array.Sort(arr);
- A = arr[0];
- B = arr[1];
- C = arr[2];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement