Advertisement
Sim0o0na

Untitled

Jun 8th, 2017
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApplication3
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.  
  15.             int a = int.Parse(Console.ReadLine());
  16.             int b = int.Parse(Console.ReadLine());
  17.             int c = int.Parse(Console.ReadLine());
  18.  
  19.  
  20.             int valid = 0;
  21.          
  22.  
  23.             if ((a + b) > c)
  24.             {
  25.                 if ((b + c) > a)
  26.                 {
  27.                     if ((a + c) > b) //If a+b>c and a+c>b and b+c>a then it is valid  
  28.                     {
  29.                         valid = 1;
  30.                     }
  31.                 }
  32.             }
  33.  
  34.             if (valid == 1)
  35.             {
  36.                 Console.WriteLine("Triangle is valid.\n");
  37.             }
  38.             else
  39.             {
  40.                 Console.WriteLine("Triangle is not valid.\n");
  41.             }          
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement