7 kyu

Triangular Treasure

2,604 of 29,031JulianNicholls

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

More By Author:

Check out these other kata created by JulianNicholls

Stats:

CreatedOct 16, 2013
PublishedOct 16, 2013
Warriors Trained53468
Total Skips6698
Total Code Submissions103324
Total Times Completed29031
Ruby Completions2604
JavaScript Completions9725
CoffeeScript Completions474
Haskell Completions626
C# Completions2510
Java Completions5231
Python Completions4661
Dart Completions1188
Swift Completions1673
C Completions629
Clojure Completions66
COBOL Completions12
Factor Completions15
Julia Completions31
Rust Completions221
NASM Completions61
SQL Completions979
TypeScript Completions121
Scala Completions19
Total Stars286
% of votes with a positive feedback rating84% of 2613
Total "Very Satisfied" Votes1949
Total "Somewhat Satisfied" Votes516
Total "Not Satisfied" Votes148
Ad
Contributors
  • JulianNicholls Avatar
  • jhoffner Avatar
  • SagePtr Avatar
  • bkaes Avatar
  • GiacomoSorbi Avatar
  • TehCupcakes Avatar
  • kiwaa Avatar
  • lessonteacher Avatar
  • JohnTheBastard Avatar
  • kazk Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • Madjosz Avatar
  • rowcased Avatar
  • rsa Avatar
  • monadius Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • mauro-1 Avatar
  • Kacarott Avatar
  • dfhwze Avatar
  • Mednoob Avatar
  • KayleighWasTaken Avatar
Ad