Cody

Problem 2161. Let's get back to school, and create multiplication tables

Solution 1818684

Submitted on 17 May 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   Fail
start = 1; endno = 10; y_correct = [1 2 3 4 5 6 7 8 9 10; 2 4 6 8 10 12 14 16 18 20; 3 6 9 12 15 18 21 24 27 30; 4 8 12 16 20 24 28 32 36 40; 5 10 15 20 25 30 35 40 45 50; 6 12 18 24 30 36 42 48 54 60; 7 14 21 28 35 42 49 56 63 70; 8 16 24 32 40 48 56 64 72 80; 9 18 27 36 45 54 63 72 81 90; 10 20 30 40 50 60 70 80 90 100;]; assert(isequal(Tables(start, endno),y_correct))

table = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in Tables (line 6) table(i,j-start) = i*j; Error in Test1 (line 13) assert(isequal(Tables(start, endno),y_correct))

2   Fail
start = 17; endno = 19; y_correct = [17 18 19; 34 36 38; 51 54 57; 68 72 76; 85 90 95; 102 108 114; 119 126 133; 136 144 152; 153 162 171; 170 180 190;]; assert(isequal(Tables(start, endno),y_correct))

table = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in Tables (line 6) table(i,j-start) = i*j; Error in Test2 (line 13) assert(isequal(Tables(start, endno),y_correct))

3   Fail
start = 21; endno = 22; y_correct =[21 22; 42 44; 63 66; 84 88; 105 110; 126 132; 147 154; 168 176; 189 198; 210 220;] assert(isequal(Tables(start, endno),y_correct))

y_correct = 21 22 42 44 63 66 84 88 105 110 126 132 147 154 168 176 189 198 210 220 table = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in Tables (line 6) table(i,j-start) = i*j; Error in Test3 (line 14) assert(isequal(Tables(start, endno),y_correct))

Suggested Problems

More from this Author25

Community Treasure Hunt

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

Start Hunting!