Register now or log in to join your professional community.
answer Pythagoras program; var a, b: real; begin write ('Enter the length of the hypotenuse:'); readln (a, b); writeln ('The length of the hypotenuse c =', sqrt (a * a + b * b)); readln; end.
I will write a very simple program using C++ language.
------------------------------------------------------------
#include <iostream.h>
void main(){
float a, b;
cin >> a;
cin >> b;
cout << "the hypotenuse equal to: " << sqrt(a*a+b*b);
}
Using Java
--------------------------------------------------------------------
package com.java2novice.math;
public class MyHypotEx {
public static void main(String[] args) {
int x =10;
int y =20;
System.out.println("The length of hypotenuse is: "+Math.hypot(x, y));
}
}
Use excel, using hyp C^2= length A^2 + width B^2, you can fill it in for every Length and Width.
- Get the input of the first line and store it in a variable called "line1".
- Get the input of the second line and store it in a variable called "line2".
- Get the sum of "line1" and "line2" and store it in a variable called "hypotenuse_squared".
- Take the square root of "hypotenuse_squared" and, after that, display it to the user as output.
simple....
L ABC is a triangle where B is90 degree , and AC is hypo.
so AC(hypo) = (BC square +AB square)
Assume ABC is a Right Angled Triangle, Angle B is90 degrees. AC is your Hypotenuse, AB is your opposite side and BC is your Adjacent side.
Pythagorean theorem is (hyp)^2 = (opp.side)^2 + (adj.side)^2
#include <stdio.h>
#include<math.h>
main()
{
float oppSide,adjSide,hypotenuse;
scanf("Enter value of the opposite side =%f ", &oppSide);
scanf("Enter value of the Adjacent side =%f", &adjSide);
hypotenuse = sqrt( ((oppSide)* (oppSide)) +((adjSide)*(adjSide)) );
printf(" hypotenuse of the given other sides of right angled triangle is :%f", hypotenuse );
}