Ad
Code
Diff
  • //Крюков Кирилл
    function sumNechet(a, b) {
      var answer = 0;
      for (var i = a; i <= b; i++){
        if (i % 2 != 0){
          answer += i;
        }
      }
      return answer;
    }
    
    console.log(sumNechet(5,15));
    • //Крюков Кирилл
    • function sumNechet(a, b) {
    • var answer = 0;
    • for (var i = a; i <= b; i++){
    • if (i % 2 != 0){
    • answer = answer + i;
    • answer += i;
    • }
    • }
    • return answer;
    • }
    • console.log(sumNechet(5,15));