0
Find sum of squares of numbers
easy code
4 odpowiedzi
+ 2
which language ?
in js it could be
var a = 2, b = 3;
var c = Math.pow(a,2)+Math.pow(b,2);
OR
var a = 2, b = 3;
var c = a*a+b*b;
in ruby :
a = 2
b = 3
c = a**2+b**2
+ 1
I did this for VcC 's challenge
You enter a number and it finds the sum of least squares
https://www.sololearn.com/Discuss/1050287/?ref=app
https://code.sololearn.com/c6DuuGjp8imR/?ref=app
0
c/c++
int a = 2;
int b = 3;
int c = (a*a) + (b*b);
0
In python:
S ={2,5,6}
def squareSum(S):
return sum([x**2 for x in S])
squareSum(S) # correctly returns 65