Progress on module: 7)

This commit is contained in:
Sangelo 2023-03-07 20:09:38 +01:00
parent 578cdc0153
commit 6596c959f2
2 changed files with 17 additions and 0 deletions

View File

@ -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);
}
}