saimun1

[EXAM PREP] Sums 3 number

Jul 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _05_Date_After_5_Days
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.     //https://csharp-book.softuni.bg/chapter-08-exam-preparation.html
  13.         {
  14.             int a = int.Parse(Console.ReadLine());
  15.             int b = int.Parse(Console.ReadLine());
  16.             int c = int.Parse(Console.ReadLine());
  17.  
  18.             if (a + b == c)
  19.             {
  20.                 if (b >= a)
  21.                     Console.WriteLine("{0} + {1} = {2}", a, b, c);
  22.                 else
  23.                     Console.WriteLine("{0} + {1} = {2}", b, a, c);
  24.  
  25.             }
  26.             if (b + c == a)
  27.             {
  28.                 if (b >= c)
  29.                     Console.WriteLine("{0} + {1} = {2}", c, b, a);
  30.                 else
  31.                     Console.WriteLine("{0} + {1} = {2}", b, c, a);
  32.  
  33.             }
  34.             if (c + a == b)
  35.             {
  36.                 if (c >= a)
  37.                     Console.WriteLine("{0} + {1} = {2}", a, c, b);
  38.                 else
  39.                     Console.WriteLine("{0} + {1} = {2}", c, a, b);
  40.  
  41.             }
  42.             else
  43.             {
  44.                 Console.WriteLine("No");
  45.             }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment