# How To Test A Valid Combination For Right Angle Traingle Using Java

March 14, 2013
Right angle triangle is those triangle whose One angle is 90 degree. Again one more important property is Addition of squire of two sides is equal to the squire of of the third side.

As per the picture either <ACB,<CAB,<ABC should be 90 degree here <ACB is 90 degree

.

The second property is AC*AC+BC*BC=AB*AB

So if you get length of 3 sides then we can check if that is a right angle triangle.

here is a simple java class to test if the given side can form a right angle triangle.

As per the picture either <ACB,<CAB,<ABC should be 90 degree here <ACB is 90 degree

.

The second property is AC*AC+BC*BC=AB*AB

So if you get length of 3 sides then we can check if that is a right angle triangle.

here is a simple java class to test if the given side can form a right angle triangle.

### Pythagorean theorem

Since the fourth century AD, Pythagoras has commonly been given credit for discovering the Pythagorean theorem, a theorem in geometry that states that in a right-angled triangle the area of the square on the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares of the other two sides—that is, .

While the theorem that now bears his name was known and previously utilized by the Babylonians and Indians, he, or his students, are often said to have constructed the first proof. It must, however, be stressed that the way in which the Babylonians handled Pythagorean numbers implies that they knew that the principle was generally applicable, and knew some kind of proof, which has not yet been found in the (still largely unpublished) cuneiform sources.Because of the secretive nature of his school and the custom of its students to attribute everything to their teacher, there is no evidence that Pythagoras himself worked on or proved this theorem. For that matter, there is no evidence that he worked on any mathematical or meta-mathematical problems. Some attribute it as a carefully constructed myth by followers of Plato over two centuries after the death of Pythagoras, mainly to bolster the case for Platonic meta-physics, which resonate well with the ideas they attributed to Pythagoras. This attribution has stuck down the centuries up to modern times.The earliest known mention of Pythagoras's name in connection with the theorem occurred five centuries after his death, in the writings of Cicero and Plutarch.--As per Wiki

public class TrangleTest { /** * @param args */ public static void main(String[] args) { // take your inputyou can use some other way to get user input also int a=3; int b=4; int c=5; System.out.print(checkTrangle(a,b,c)); } public static String checkTrangle(int a,int b,int c) { if((squ(a)==squ(b)+ squ(c))||(squ(b)==squ(a)+ squ(c))||(squ(c)==squ(a) +squ(b))) { //checking if AC*AC+BC*BC=AB*AB in terms of length return "This can be a valid right angle triangle"; } else { return "This can not be a valid right angle triangle"; } } public static double squ(int a) { // this method will squire the given length return a*a; } }We are done. From this code if length of 3 side are given , We can easily find out if the combination can form a right angle triangle.

## 0 comments