+ 3
CHALLENGE - Triangular Numbers
Triangular numbers are a math series that represent the number of points in a triangle, for example the number of bowling pins. The first number is 1. The next row would have 2 for a total of 3. The next row would have 3 for a total of 6. https://en.m.wikipedia.org/wiki/Triangular_number The challenge is to write a program to return the nth triangular number based on user input. For an additional challenge, print a diagram of the triangle with the number in each row represented by "X"s! Good luck!
5 Antworten
+ 4
I couldn't make a nice tree with these numbers..
https://code.sololearn.com/chM4I4m8fUO5
+ 4
Kindly post this as an assignment, as then it will gather a larger number of submissions. You will get a lesson creator badge for 10 such assignments, along with some XP.
Just open Lesson Factory and give it a shot!
+ 4
Made code in the train on my way to work:
https://code.sololearn.com/c2LwfKJPcoyX/?ref=app
+ 3
https://code.sololearn.com/c5IbQo408TOt/?ref=app
https://code.sololearn.com/c1N07Cf4HpNn/?ref=app
+ 1
print(n*(n+1)/2)