write a program to input three numbers and print sum of squares of the number
please i need the anwer fast
Answers
Answer:
import java.util.*;
public class prog
{
public static void main(String[]args)
{
Scanner in = new Scanner(System.in);
int a,b,c, sum =0;
System.out.println("Enter three numbers :");
a= in.nextInt();
b=in.nextInt();
c=in.nextInt();
sum = (a*a)+(b*b)+(c*c);
System.out.println("Sum of Square of entered numbers are : "+sum);
}
}
Explanation:
This is Java Coding, and procedures for other languages may be different
Explanation:
You have not mentioned any specific language. So, I am writing this program in C++ :
#include <iostream>
using namespace std;
int main()
{
int x,y,z,sumOfSquare;
cout << "Enter first number : ";
cin >> x;
cout << "Enter second number : ";
cin >> y;
cout << "Enter third number : ";
cin >> z;
sumOfSquare = x*x + y*y + z*z;
cout << " Sum of squares of given numbers is : " << sumOfSquare << endl;
return 0;
}