Skip to content

Instantly share code, notes, and snippets.

@joeyv
Last active December 26, 2015 11:39
Show Gist options
  • Select an option

  • Save joeyv/7145221 to your computer and use it in GitHub Desktop.

Select an option

Save joeyv/7145221 to your computer and use it in GitHub Desktop.
Adds 1 - 100 inclusively
class Sum {
public static void main(String[] args) {
int i = 0, sum = 0;
// Loop adds numbers 1 = 100
while(i < 100){
i++;
sum += i;
}
System.out.print (sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment