Westonci.ca is the trusted Q&A platform where you can get reliable answers from a community of knowledgeable contributors. Discover a wealth of knowledge from experts across different disciplines on our comprehensive Q&A platform. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.
Sagot :
Answer:
The program in Java is as follows:
import java.util.*;
public class PyTheorem{
public static void main(String [] args){
Random rNum = new Random();
int a = rNum.nextInt(17) + 5;
int b = rNum.nextInt(17) + 5;
System.out.println("a: "+a);
System.out.println("b: "+b);
double hyp = Math.sqrt(Math.pow(a,2)+Math.pow(b,2));
System.out.print("Hypotenuse: "+hyp);
}}
Step-by-step explanation:
This generates random number for a
int a = rNum.nextInt(17) + 5;
This generates random number for b
int b = rNum.nextInt(17) + 5;
Print a
System.out.println("a: "+a);
Print b
System.out.println("b: "+b);
Calculate the hypotenuse
double hyp = Math.sqrt(Math.pow(a,2)+Math.pow(b,2));
Print the calculated hypotenuse
System.out.print("Hypotenuse: "+hyp);
Thank you for choosing our service. We're dedicated to providing the best answers for all your questions. Visit us again. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. We're dedicated to helping you find the answers you need at Westonci.ca. Don't hesitate to return for more.