Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 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 TriangleFormations
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int sideA = int.Parse(Console.ReadLine());
  14. int sideB = int.Parse(Console.ReadLine());
  15. int sideC = int.Parse(Console.ReadLine());
  16.  
  17. if (sideA + sideB >= sideC || sideC + sideB >= sideA)
  18. {
  19. Console.WriteLine("Triangle is valid.");
  20. if (sideA * sideA + sideB * sideB == sideC * sideC)
  21. {
  22. Console.WriteLine("Triangle has a right angle between sides a and b");
  23. }
  24. else if (sideC * sideC + sideA * sideA == sideB * sideB)
  25. {
  26. Console.WriteLine("Triangle has a right angle between sides a and c");
  27. }
  28. else if (sideB * sideB + sideC * sideC == sideA * sideA)
  29. {
  30. Console.WriteLine("Triangle has a right angle between sides b and c");
  31. }
  32. else
  33. {
  34. Console.WriteLine("Triangle has no right angles");
  35. }
  36.  
  37. }
  38. else
  39. {
  40. Console.WriteLine("Invalid Triangle.");
  41. }
  42.  
  43.  
  44. // if (2 * sideA + 2 * sideB != 2 * sideC || 2 * sideC + 2 * sideA != 2 * sideB || 2 * sideB + 2 * sideC != 2 * sideA)
  45. // {
  46. // Console.WriteLine("Invalid Triangle");
  47. // }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement