Computer Science, asked by ayushjha5982, 19 days ago

WAP to assign 25 and 30 to two different variables. Fin d the square of both numbers and then print the sum and product of the squares​

Answers

Answered by JahanviJ
0

Answer:

class pg1

{

public static void main ()

{

int a = 25 , b = 30;

System.out.println("Sum of squares is "

+((a*a)+(b*b)));

System.out.println("Product of squares is "

+((a*a)*(b*b)));

}

}

Explanation:

This how you can solve this problem. First declare two variables. Let's say a and b and then assign the given values to them. Do the calculations as shown. You can also use Math.pow() function to find the Square, and also you can take another variable outside the print statement and calculate there and store that in those variables. Then can print those variables.

Hope it helps...

Similar questions