7.2.12--Declare a function name sumOfEven. It takes a number parameter and it adds all the even numbers in that - range.
function sumOfEvens(n)
{
let sum=0;
for(i=0;i<=n;i=i+2)
{
sum+=i;
}
return `Sum of even no. in the range ${n}=${sum}`;
}
console.log(sumOfEvens(20));
console.log(sumOfEvens(4));
7.2.12--Declare a function name sumOfEven. It takes a number parameter and it adds all the even numbers in that - range.
output