Answers for "even number program in c++ using for loop stack overflow"

C++
0

even number program in c++ using for loop stack overflow

int func(int x, int y){
      if(y>x && x>0){
        int res = x;
        for(int i = x+1 ; i <= y ; i+=1){
          if(i%2==0)
            res += i;
          else
            res *= i;
        }
        return res;
      }
      return -1;
    }
Posted by: Guest on October-10-2021

Code answers related to "even number program in c++ using for loop stack overflow"

Browse Popular Code Answers by Language