Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 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 Triangle
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var a = decimal.Parse(Console.ReadLine());
  14.             var b = decimal.Parse(Console.ReadLine());
  15.             var c = decimal.Parse(Console.ReadLine());
  16.  
  17.             if (a < b + c && b < a + c && c < a + b)
  18.             {
  19.                 if (a == b && b == c)
  20.                 {
  21.                     Console.WriteLine("Triangle with sides {0}, {1} and {2} is equilateral.",
  22.                         a.ToString("0.###"), b.ToString("0.###"), c.ToString("0.###"));
  23.                 }
  24.                 else if (a == b)
  25.                 {
  26.                     Console.WriteLine("Triangle with sides {0}, {1} and {2} is isosceles.",
  27.                         a.ToString("0.###"), b.ToString("0.###"), c.ToString("0.###"));
  28.                 }
  29.                 else
  30.                 {
  31.                     Console.WriteLine("Triangle with sides {0}, {1} and {2} is scalene.",
  32.                         a.ToString("0.###"), b.ToString("0.###"), c.ToString("0.###"));
  33.                 }
  34.             }
  35.             else
  36.             {
  37.                 Console.WriteLine("There is no triangle with sides {0}, {1} and {2}.",
  38.                     a.ToString("0.###"), b.ToString("0.###"), c.ToString("0.###"));
  39.             }
  40.         }
  41.  
  42.        
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement