The problem says the input is a positive integer but the first test inputs 0. In my code that caused r = 0/0 error. Please change the wording to "input is non-negative".
How to find the position of an element in a vector without using the find function
2482 Solvers
Project Euler: Problem 6, Natural numbers, squares and sums.
1034 Solvers
976 Solvers
674 Solvers
Height of a right-angled triangle
468 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!