26 lines
575 B
C#
26 lines
575 B
C#
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));
|
|
}
|
|
}
|
|
}
|