7 kyu
Triangular Treasure
4,806 of 29,427JulianNicholls
Description:
Triangular numbers are so called because of the equilateral triangular shape that they occupy when laid out as dots. i.e.
1st (1) 2nd (3) 3rd (6)
* ** ***
* **
*
You need to return the nth triangular number. You should return 0 for out of range values:
For example: (Input --> Output)
0 --> 0
2 --> 3
3 --> 6
-10 --> 0
Algorithms
Mathematics
Similar Kata:
Stats:
Created | Oct 16, 2013 |
Published | Oct 16, 2013 |
Warriors Trained | 54180 |
Total Skips | 6725 |
Total Code Submissions | 104510 |
Total Times Completed | 29427 |
Ruby Completions | 2610 |
JavaScript Completions | 9806 |
CoffeeScript Completions | 475 |
Haskell Completions | 629 |
C# Completions | 2524 |
Java Completions | 5270 |
Python Completions | 4806 |
Dart Completions | 1205 |
Swift Completions | 1683 |
C Completions | 642 |
Clojure Completions | 67 |
COBOL Completions | 13 |
Factor Completions | 16 |
Julia Completions | 32 |
Rust Completions | 234 |
NASM Completions | 62 |
SQL Completions | 1040 |
TypeScript Completions | 126 |
Scala Completions | 22 |
C++ Completions | 39 |
Total Stars | 290 |
% of votes with a positive feedback rating | 84% of 2630 |
Total "Very Satisfied" Votes | 1962 |
Total "Somewhat Satisfied" Votes | 520 |
Total "Not Satisfied" Votes | 148 |