Cody

Problem 45363. Exponentiation

Solution 3343693

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   Pass
assert(isequal(mod_expo(5,3,13),8))

ans = 8

2   Pass
assert(isequal(mod_expo(10,4,11),1))

ans = 1

3   Pass
assert(isequal(mod_expo(4,13,497),445))

ans = 445

4   Pass
assert(isequal(mod_expo(4,311,497),464))

ans = 464

5   Fail
assert(isequal(mod_expo(50,300,13),1))

ans = NaN

Assertion failed.

6   Fail
assert(isequal(mod_expo(1000,300,23),3))

ans = NaN

Assertion failed.

7   Pass
assert(isequal(mod_expo(64,43,4),0))

ans = 0

8   Fail
assert(isequal(mod_expo(644,43,5),4))

ans = 2

Assertion failed.

9   Fail
assert(isequal(mod_expo(327,211,56),47))

ans = NaN

Assertion failed.

10   Fail
assert(isequal(mod_expo(3277,211,234),1))

ans = NaN

Assertion failed.

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!