Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #number #program #loop #stack #overflow
ADD COMMENT
Topic
Name
5+4 =