Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TriangleFormations
- {
- class Program
- {
- static void Main(string[] args)
- {
- int sideA = int.Parse(Console.ReadLine());
- int sideB = int.Parse(Console.ReadLine());
- int sideC = int.Parse(Console.ReadLine());
- if (sideA + sideB >= sideC || sideC + sideB >= sideA)
- {
- Console.WriteLine("Triangle is valid.");
- if (sideA * sideA + sideB * sideB == sideC * sideC)
- {
- Console.WriteLine("Triangle has a right angle between sides a and b");
- }
- else if (sideC * sideC + sideA * sideA == sideB * sideB)
- {
- Console.WriteLine("Triangle has a right angle between sides a and c");
- }
- else if (sideB * sideB + sideC * sideC == sideA * sideA)
- {
- Console.WriteLine("Triangle has a right angle between sides b and c");
- }
- else
- {
- Console.WriteLine("Triangle has no right angles");
- }
- }
- else
- {
- Console.WriteLine("Invalid Triangle.");
- }
- // if (2 * sideA + 2 * sideB != 2 * sideC || 2 * sideC + 2 * sideA != 2 * sideB || 2 * sideB + 2 * sideC != 2 * sideA)
- // {
- // Console.WriteLine("Invalid Triangle");
- // }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement