/** * @author lautturi.com * Java example: calculate the hypotenuse of triangle using pythagoras method */ import java.util.*; public class Lautturi { public static void main(String[] args) { double adjacent = 3; double opposite = 4; double hypotenuse= Math.sqrt((adjacent*adjacent)+(opposite*opposite)); System.out.println(hypotenuse); } }
output:
5.0