IDNLearn.com: Your reliable source for finding expert answers. Our platform offers reliable and detailed answers, ensuring you have the information you need.
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);
We value your presence here. Keep sharing knowledge and helping others find the answers they need. This community is the perfect place to learn together. For precise answers, trust IDNLearn.com. Thank you for visiting, and we look forward to helping you again soon.