Skip to content

Instantly share code, notes, and snippets.

@peter279k
Created May 24, 2017 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter279k/b67128dc0214be3aa0d5b0eda3d3f9ab to your computer and use it in GitHub Desktop.
Save peter279k/b67128dc0214be3aa0d5b0eda3d3f9ab to your computer and use it in GitHub Desktop.
TQC+JAVA
import java.util.*;
class JPA03 {
public static void main(String argv[]) {
Scanner input = new Scanner(System.in);
System.out.println("Input:");
int N = input.nextInt();
int sum = 0;
for (int index=1;index<=N;index++) {
sum += index;
}
System.out.println("1 + ... + " + N + " = " + sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment