Advertisement
bacco

Triangle

Feb 6th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var a = double.Parse(Console.ReadLine());
  10.             var b = double.Parse(Console.ReadLine());
  11.             var c = double.Parse(Console.ReadLine());
  12.  
  13.             if (a < (b + c)  && b < (a + c)  &&  c < (a + b))
  14.             {
  15.                 if ((a == b && a != c) || (a == c && a != b) || (b == c && b != a))
  16.                 {
  17.                     Console.WriteLine($"Triangle with sides {a}, {b} and {c} is isosceles.");
  18.                 }
  19.                 else if (a == b && a == c)
  20.                 {
  21.                     Console.WriteLine($"Triangle with sides {a}, {b} and {c} is equilateral.");
  22.                 }
  23.                 else
  24.                 {
  25.                     Console.WriteLine($"Triangle with sides {a}, {b} and {c} is scalene.");
  26.                 }
  27.             }
  28.             else
  29.             {
  30.                 Console.WriteLine($"There is no triangle with sides {a}, {b} and {c}. ");
  31.             }
  32.          
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement