26 lines
575 B
C#
Raw Permalink Normal View History

2021-09-02 08:31:01 -03:00
using System;
namespace exercicios
{
class Exercicio8
{
public static void Init()
{
float b,a;
Console.WriteLine("Hypotenuse Calculator\nInsert the values for b (triangle base) & a (triangle height).");
b = float.Parse(Console.ReadLine());
a = float.Parse(Console.ReadLine());
Console.WriteLine("\nTriangle base {0}, Height {1}, Hypotenuse {2:N2}",
b,
a,
hipotenusa(a,b));
}
static float hipotenusa(float b, float a)
{
return (float)Math.Sqrt((b*b)+(a*a));
}
}
}