public class SumMethod { public static int sum(int a, int b) { int s, i; // Help variables used to write program s = 0; // s = current total for (i = a; i <= b; i++ ) s = s + i; // Add next number to total return s; // Return the total as output } public static void main(String[] args) { int i, s; s = SumMethod.sum(1, 10); // Invoke sum with a = 1 and b = 10 System.out.println("sum(1,10) = " + s); s = SumMethod.sum(23, 36); // Invoke sum with a = 23 and b = 36 System.out.println("sum(23,36) = " + s); } }