Skip to content

Instantly share code, notes, and snippets.

@AmruthPillai
Created July 22, 2017 17:57
Show Gist options
  • Save AmruthPillai/d91da32ac294d89d43199b2003805b40 to your computer and use it in GitHub Desktop.
Save AmruthPillai/d91da32ac294d89d43199b2003805b40 to your computer and use it in GitHub Desktop.
Any of the series of numbers (1, 3, 6, 10, 15, etc.) obtained by continued summation of the natural numbers 1, 2, 3, 4, 5, etc. Read more here: https://www.mathsisfun.com/algebra/triangular-numbers.html
public class TriangularNumbers {
public static void main(String[] args) {
int n = 0;
for (int i = 1; i <= 10; i++)
System.out.println(n += i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment