formula for sum of n numbers
Sum of the First n Natural Numbers. We prove the formula 1+ 2+ ... + n = n(n+1) / 2, for n a natural number
formula for sum of n numbers
Sum of the First n Natural Numbers. We prove the formula 1+ 2+ ... + n = n(n+1) / 2, for n a natural number
Sum of all the multiples of 3 or 5
const findSum = n => {
let countArr = []
for(let i = 0; i <= n; i++) if(i % 3 === 0 || i % 5 === 0) countArr.push(i)
return countArr.reduce((acc , curr) => acc + curr)
}
console.log(findSum(5))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us