Progress on module: 7)
This commit is contained in:
parent
578cdc0153
commit
6596c959f2
|
@ -0,0 +1,17 @@
|
||||||
|
package net.stelian.m319.projectThree;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class Pythagoras {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner input = new Scanner(System.in);
|
||||||
|
System.out.print("Enter the length of the first shorter side: ");
|
||||||
|
double side1 = input.nextDouble();
|
||||||
|
|
||||||
|
System.out.print("Enter the length of the second shorter side: ");
|
||||||
|
double side2 = input.nextDouble();
|
||||||
|
|
||||||
|
double hypotenuse = Math.sqrt(Math.pow(side1, 2) + Math.pow(side2, 2));
|
||||||
|
// sqrt(side1^2) + side2^2
|
||||||
|
System.out.println("The length of the hypotenuse is: " + hypotenuse);
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Loading…
Reference in New Issue