public class MethodDemo {
  public static int sum(int i1, int i2) {
    int result = 0; 
    for (int i = i1; i <= i2; i++) 
      result += i; 
  	
    return result; 
  }
	
  public static void main(String[] args) { 
    System.out.println("Suma liczb od 1 do 10 wynosi " + sum(1, 10)); 
    System.out.println("Suma liczb od 20 do 37 wynosi " + sum(20, 37));
    System.out.println("Suma liczb od 35 do 49 wynosi " + sum(35, 49)); 
  }
}