“Quadrat (n) Summe” Code-Antworten

Quadrat (n) Summe

def square_sum(numbers):
    return sum(x ** 2 for x in numbers)
Code language: Python (python)
Ian

Quadrat (n) Summe

/*
// Complete the square sum function so that it squares each number passed into 
	it and then sums the results together.
// For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9.
*/

const squareSum = numbers => numbers.reduce((acc, cur) => acc + cur ** 2, 0)

// With love @kouqhar
kouqhar

Quadrat (n) Summe

function squareSum(numbers){
  let sum =0 
  for(let i =0; i<numbers.length;i++){
    sum += numbers[i]* numbers[i]
    
  }
  return sum

}
ABS

Ähnliche Antworten wie “Quadrat (n) Summe”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen