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
Comments
Leave a comment