wap to assign any three number and print the sum of their squares in Java program
Answers
Answered by
2
Answer:
class X43
{
public static void main ( )
{
int a = 3;
int b = 6;
int c= 9;
int a1= a*a;
int b1= b*b;
int c1=c*c;
int s= a1+b1+c1;
System.out.println("Sum of the square of the assigned numbers is" +s);
}
}
as long as it is programmer assigned
Explanation:
import java.io.*;
class Good
{
public static void main ( ) throws IOException
{
Buffered Reader Input = new Buffered Reader ( new Input Stream Reader (system.in));
for (int k= 1; k<= 3; k++)
{
System.out.println("enter a number");
int a = Integer.parse int(Input.readLine);
int s=0;
int s= s+a*a;
}
System.out.println("Sum of the square of the assigned numbers is" +s);
}
}
as long as it is user assigned
Similar questions