Untitled
unknown
csharp
13 days ago
779 B
5
Indexable
// 1. Sprawdzenie czy da się skontruować trójkąt int bokA = int.Parse(Console.ReadLine()!); int bokB = int.Parse(Console.ReadLine()!); int bokC = int.Parse(Console.ReadLine()!); if (bokA + bokB > bokC && bokB + bokC > bokA && bokA + bokC > bokB) { Console.WriteLine("Trójkąt da się skonstruować"); if (Math.Pow(bokA, 2) + Math.Pow(bokB, 2) == Math.Pow(bokC, 2) || Math.Pow(bokA, 2) + Math.Pow(bokC, 2) == Math.Pow(bokB, 2) || Math.Pow(bokB, 2) + Math.Pow(bokC, 2) == Math.Pow(bokA, 2) ) { Console.WriteLine("Trójkąt jest prostokątny"); } else { Console.WriteLine("Trójkąt nie jest prostokątny"); } } else { Console.WriteLine("Trójkąta nie da się skontruować"); }
Editor is loading...
Leave a Comment