A program to calculate the hypotenuse of a right angle triangle.Your program will ask the user for the lengths of the two sides adjacent to the right angle. It will then calculate the hypotenuse and print the result along with the input out to screen.
Solution:
Solution:
#include "stdafx.h"
#include <iostream>
#include <string>
#include "math.h"
#include "conio.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
//A program to calculate the hypotenuse of a right angle triangle
double a,b,Result;
cout<<"enter the first length side "<<endl;;
cin>>a;
cout<<"enter the second length side " <<endl;
cin>>b;
Result = sqrt((a*a)+(b*b));
cout<<"the result of the hypotenuse == " << Result;
getch();
return 0;
}
No comments:
Post a Comment