Cody

Solution 1901061

Submitted on 15 Aug 2019
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   Pass
assert(isequal(ord(1),'1st'))

ans = '1st'

2   Pass
assert(isequal(ord(2),'2nd'))

ans = '2nd'

3   Pass
assert(isequal(ord(3),'3rd'))

ans = '3rd'

4   Pass
assert(isequal(ord(4),'4th'))

ans = '4th'

5   Pass
assert(isequal(ord(5),'5th'))

ans = '5th'

6   Pass
assert(isequal(ord(10),'10th'))

ans = '10th'

7   Fail
assert(isequal(ord(11),'11th'))

ans = '11st'

Assertion failed.

8   Fail
assert(isequal(ord(12),'12th'))

ans = '12nd'

Assertion failed.

9   Fail
assert(isequal(ord(13),'13th'))

ans = '13rd'

Assertion failed.

10   Pass
assert(isequal(ord(14),'14th'))

ans = '14th'

11   Pass
assert(isequal(ord(15),'15th'))

ans = '15th'

12   Pass
assert(isequal(ord(82),'82nd'))

ans = '82nd'

13   Pass
assert(isequal(ord(126),'126th'))

ans = '126th'

14   Fail
assert(isequal(ord(911),'911th'))

ans = '911st'

Assertion failed.

15   Fail
assert(isequal(ord(2012),'2012th'))

ans = '2012nd'

Assertion failed.

16   Pass
assert(isequal(ord(4077),'4077th'))

ans = '4077th'

17   Pass
assert(isequal(ord(0),'0th'))

ans = '0th'

18   Fail
assert(isequal(ord(-101),'-101st'))

Array indices must be positive integers or logical values. Error in ord (line 3) ans((rem(n,10)+1)*2:end); Error in Test18 (line 1) assert(isequal(ord(-101),'-101st'))

Suggested Problems

More from this Author10