Created
July 22, 2017 17:57
-
-
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
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 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