Cody

Problem 371. Decimal Comparison

Solution 3341263

Submitted on 23 Oct 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
assert(numCmp('12.3456',12.3456))

Error: File: numCmp.m Line: 9 Column: 45 The end operator must be used within an array index expression. Error in Test1 (line 1) assert(numCmp('12.3456',12.3456))

2   Fail
assert(numCmp('12.3456',12.3456789))

Error: File: numCmp.m Line: 9 Column: 45 The end operator must be used within an array index expression. Error in Test2 (line 1) assert(numCmp('12.3456',12.3456789))

3   Fail
assert(~numCmp('12.3456',12.345))

Error: File: numCmp.m Line: 9 Column: 45 The end operator must be used within an array index expression. Error in Test3 (line 1) assert(~numCmp('12.3456',12.345))

4   Fail
assert(~numCmp('12.34567890',12.3456))

Error: File: numCmp.m Line: 9 Column: 45 The end operator must be used within an array index expression. Error in Test4 (line 1) assert(~numCmp('12.34567890',12.3456))

5   Fail
assert(numCmp('12e6',12e6))

Error: File: numCmp.m Line: 9 Column: 45 The end operator must be used within an array index expression. Error in Test5 (line 1) assert(numCmp('12e6',12e6))

6   Fail
assert(~numCmp('54',100))

Error: File: numCmp.m Line: 9 Column: 45 The end operator must be used within an array index expression. Error in Test6 (line 1) assert(~numCmp('54',100))

Suggested Problems

More from this Author56

Community Treasure Hunt

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

Start Hunting!