INPUT:
using System;
using System.Collections.Generic;
using System.Text;
namespace a
{
class hypotenous
{
double square1(double
a1)
{
double a2 = a1 * a1;
return a2;
}
double square2(double
b1)
{
double a2 = b1*b1;
return a2;
}
double hyp(double a, double b)
{
double a1=square1(a);
double b1= square2(b);
double c =Math.Sqrt(
a1 + b1);
return c;
}
double perpendicular(double
a, double b)
{
double a1 = square1(a);
double b1 = square2(b);
double c = Math.Sqrt(a1
- b1);
return c;
}
double bas(double a, double b)
{
double a1 = square1(a);
double b1 = square2(b);
double c = Math.Sqrt(a1
- b1);
return c;
}
static void Main(string[] args)
{
double a, b;
Console.WriteLine("plz
type the option base, perpendicular, hypotenouos");
string option = Console.ReadLine();
hypotenous h = new
hypotenous();
if (option == "base")
{
Console.WriteLine("plz enter the hypotenous ");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("plz enter the perpendicular");
b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("B={0}", h.bas(a, b));
}
else if (option == "perpendicular")
{
Console.WriteLine("plz enter the hypotenous ");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("plz enter the base");
b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("P={0}", h.perpendicular(a, b));
}
else if (option == "hypotenouos")
{
Console.WriteLine("plz enter the perpendicular");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("plz enter the base");
b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("H={0}", h.hyp(a, b));
}
}
}
}
No comments:
Post a Comment