I'm trying to return a variable form a for loop that is incrementing
here is my for loop i need to return the sum value (i know i need to change void from the method name)
public static void loopSum(int n){ int sum = 0; for (int i = 1; i <= n; i++) { sum = sum + i;
i need to return the value of 5050 ("n" is set to 100 in the rest of the code, i just can't seem to figure this out.
I hope i posted this in the right place. Thanks in advance!