Skip to content

Instantly share code, notes, and snippets.

@timvisee
Created September 7, 2015 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timvisee/d7fcd7c37cdbe45dee00 to your computer and use it in GitHub Desktop.
Save timvisee/d7fcd7c37cdbe45dee00 to your computer and use it in GitHub Desktop.
Challenge 1.3
package com.timvisee.hhs;
public class Main {
/** The maximum value of the sum. */
public static final int MAX = 10;
/**
* Main method called on start.
*
* @param args Startup arguments.
*/
public static void main(String[] args) {
// Calculate the sum, and print the result
System.out.println("Sum of 1 to " + MAX + ": " + (MAX * (MAX + 1) / 2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment