fbinnzhivko

Sums 3 Numbers

Mar 16th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         int first = int.Parse(Console.ReadLine());
  7.         int second = int.Parse(Console.ReadLine());
  8.         int thirt = int.Parse(Console.ReadLine());
  9.  
  10.         int max = Math.Max(first, Math.Max(second, thirt));
  11.         int min = Math.Min(first, Math.Min(second, thirt));
  12.         int sum = first + second + thirt;
  13.         var middle = sum - max - min;
  14.  
  15.         if (min + second <= max)
  16.         {
  17.             Console.WriteLine("{0}+{1}={2}", first, second, max);
  18.         }
  19.         else { Console.WriteLine("No"); }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment