简单小算法.计算1~100之间的奇数之和和偶数之和
function arr(a,b){
var sum=0;
var sum1=0;
for(var i=a;i<=b;i++){
if(i%2!=0){
sum+=i
}else{
sum1+=i
}
}
console.log(sum,sum1)
}
arr(1,100)
function arr(a,b){
var sum=0;
var sum1=0;
for(var i=a;i<=b;i++){
if(i%2!=0){
sum+=i
}else{
sum1+=i
}
}
console.log(sum,sum1)
}
arr(1,100)