CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
classProgram
{
staticvoid Main(string[]
args)
{
double b, p, h, sqh;
Console.WriteLine("please
enter per");
p
= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("please
enter base");
b = Convert.ToDouble(Console.ReadLine());
sqh = (p * p) + (b * b);
h
= Math.Sqrt(sqh);
Console.WriteLine("the
value of hyp is {0}",h);
}
}
}
OUTPUT:
ALGORITHM:
- · Start,
- · Initializing double b,p,h,sqh.
- · Output: please enter per
- · Set p: Taking input from the user
- · Output: please enter base
- · Set b: Taking input from the user
- · Set sqh: (p*p) +(b*b)
- · Set h: square root ofSet sqh
- · Output: Result
- · End.
No comments:
Post a Comment