Cody

Problem 2396. last n digit of a power function

Solution 2679206

Submitted on 11 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
base = 3; expo = 8; n = 2; y_correct = 61; assert(isequal(lastndigit(base,expo,n),y_correct))

Undefined function 'vpi' for input arguments of type 'double'. Error in lastndigit (line 3) base=vpi(base) Error in Test1 (line 3) assert(isequal(lastndigit(base,expo,n),y_correct))

2   Fail
base = 7; expo = 12; n = 5; y_correct = 87201; assert(isequal(lastndigit(base,expo,n),y_correct))

Undefined function 'vpi' for input arguments of type 'double'. Error in lastndigit (line 3) base=vpi(base) Error in Test2 (line 3) assert(isequal(lastndigit(base,expo,n),y_correct))

3   Fail
base = 25; expo = 71; n = 15; y_correct = 896881103515625; assert(isequal(lastndigit(base,expo,n),y_correct))

Undefined function 'vpi' for input arguments of type 'double'. Error in lastndigit (line 3) base=vpi(base) Error in Test3 (line 3) assert(isequal(lastndigit(base,expo,n),y_correct))

4   Fail
base = 768; expo = 1579; n = 22; y_correct = 3750595090000885317632; assert(isequal(lastndigit(base,expo,n),y_correct))

Undefined function 'vpi' for input arguments of type 'double'. Error in lastndigit (line 3) base=vpi(base) Error in Test4 (line 3) assert(isequal(lastndigit(base,expo,n),y_correct))