Created
October 19, 2019 15:36
-
-
Save rehashedprime/fea7e8b140f7a2714a6b9ee546f25c3e to your computer and use it in GitHub Desktop.
TEST.JAVA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class test { | |
public static int sum( int i1, i2) { | |
int result = 0; | |
for (int i=i1; i<= i2; i++) | |
result += i; | |
return result; | |
} | |
public static void main ( String [] args){ | |
System.out.println("Sum from 1 to 10 is " + sum(1, 10)); | |
System.out.println("Sum from 20 to 37 is " + sum(20, 37)); | |
System.out.println("Sum from 35 to 49 is " + sum(35, 49)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment