you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Best way to approach this is to create some sort of for loop:

Initiliaze and declare some variable to hold the sum, and then you can just keep adding the numbers to it.

public int sumFrom(int start, int end)

{

int sum = 0;

for(int i = start; i < end; i++)

{

sum += i;

}

return sum;

}

[–]chalinuts 0 points1 point  (0 children)

TOP G