Untitled
Anonymous
csharp
03/11/2025 4:49 PM
1.0 KB
20
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