Cody

Problem 933. Ordinal numbers

Solution 3023974

Submitted on 1 Oct 2020 at 21:37
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(isequal(ord(1),'1st'))

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in ord (line 13) s(st,one) = 's'; Error in Test1 (line 1) assert(isequal(ord(1),'1st'))

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

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in ord (line 13) s(st,one) = 's'; Error in Test2 (line 1) assert(isequal(ord(2),'2nd'))

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

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in ord (line 13) s(st,one) = 's'; Error in Test3 (line 1) assert(isequal(ord(3),'3rd'))

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

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in ord (line 13) s(st,one) = 's'; Error in Test4 (line 1) assert(isequal(ord(4),'4th'))

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

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in ord (line 13) s(st,one) = 's'; Error in Test5 (line 1) assert(isequal(ord(5),'5th'))

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in ord (line 13) s(st,one) = 's'; Error in Test17 (line 1) assert(isequal(ord(0),'0th'))

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

Assertion failed.

Suggested Problems

More from this Author10

Community Treasure Hunt

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

Start Hunting!