Problem 5. Triangle Numbers
Solution Stats
Problem Comments
-
24 Comments
i dint realize i was writing a code for sum of first n natural numbers instead of computing n*(n+1)/2
Man, this takes me back to algebra... Its more fun in MATLAB tho!
It's interesting to work with and building the confidence to solve problems....nice
Good one. Reminds me of those old school days..!!
All solutions with score 10 or 11 use the regexp cheat.
Jon or anybody!
Can you explain how the regexp cheat works?
How do you reduce the size of your code?
mucha fantasía en el titulo
what it means?
I really had to use my brain for this problem
Interesting!
sound simple but annoying
Funny and interesting problem!
good!
For clarity sake,
t = triangle (n)
We need to calculate t for a given n
It is pretty easy but tricky!
Why doesn't this work?
function t = triangle(n)
t=1
for i=[1:(n+1)]
t=t+i;
t
end
that was fun
Cool problem!
Interesting
cool
The formula makes this an easy math problem.
Good Question
+10 points
Solution Comments
Show commentsProblem Recent Solvers26821
Suggested Problems
-
8850 Solvers
-
10631 Solvers
-
Is this triangle right-angled?
5667 Solvers
-
Find out sum of all elements of given Matrix
497 Solvers
-
632 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!