public int sum (int num1, int num2){
int sum = 0;
if(num2>num1){
for (int i = num1; i<=num2; i++){
sum = sum + i;
}
}
else{
for (int i = num2; i <= num1; i++){
sum = sum + i;
}
}
System.out.println("The sum between " +num1+ " and " +num2+ " equals " + sum);
return sum(num1, num2);
}
}
infinite loop problem. any fixes? trying to find the sum of all the numbers between two inputs. this is the class definition any ideas?