Answer to Question #45923 in Java | JSP | JSF for Kalibana

Question #45923
Three integer numbers (x,y,z)are known as Paty Triple if the three numbers satisfy the following criterion: X^2 + Y^2 = Z^2 The first few triples are shown below. Count X Y Z 1) 3 4 5 2) 5 12 13 3) 6 8 10 4) 7 24 25 5) 8 15 17 The program should generate all such numbers where X and Y are in the range 1 to 100 using the following guidelines: Use a loop to generate the value for X in the range 1 to 100. Now,use a nested loop to generate the values for Y. Your loop should not generate duplicates- for e.g.,(3,4,5) and (4,3,5) are the same. Calculate the sum of the squares of the value X and Y. Using the Math.sqrt method.calculate the square root of the above sum.The Math.sqrt method returns a double type.(For e..g, Math.sqrt(13) would return 3.6055…) Cast the above double value to an integer,say Z. Now,check if the square of this integer is the same as the value from step (c) If the
Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog