Cody

Problem 44289. Find two triangular numbers whose sum is input.

Solution 2705940

Submitted on 17 Jul 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
x = 400; y_correct = [190 210]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test1 (line 3) assert(isequal(twoTriangular(x),y_correct))

2   Fail
x = 196; y_correct = [91 105]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test2 (line 3) assert(isequal(twoTriangular(x),y_correct))

3   Fail
x = 676; y_correct = [325 351]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test3 (line 3) assert(isequal(twoTriangular(x),y_correct))

4   Fail
x = 1225; y_correct = [595 630]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test4 (line 3) assert(isequal(twoTriangular(x),y_correct))

5   Fail
x = 1849; y_correct = [903 946]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test5 (line 3) assert(isequal(twoTriangular(x),y_correct))

6   Fail
x = 10000; y_correct = [4950 5050]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test6 (line 3) assert(isequal(twoTriangular(x),y_correct))

7   Fail
x = 11025; y_correct = [5460 5565]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0

Unrecognized function or variable 'n'. Error in twoTriangular (line 5) for i=1: n/2 Error in Test7 (line 3) assert(isequal(twoTriangular(x),y_correct))

Suggested Problems

More from this Author72

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!