Cody

Problem 42321. given number is power of n or not?

Solution 2267172

Submitted on 9 May 2020 by Dyuman Joshi
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
x = 16; n=2 y_correct = 'true'; assert(isequal(Powerof(x,n),y_correct))

n = 2 ans = 'true'

2   Pass
x = 14; n=2 y_correct = 'false'; assert(isequal(Powerof(x,n),y_correct))

n = 2 ans = 'false'

3   Pass
x = 64; n=4 y_correct = 'true'; assert(isequal(Powerof(x,n),y_correct))

n = 4 ans = 'true'

4   Pass
x = 625; n=5 y_correct = 'true'; assert(isequal(Powerof(x,n),y_correct))

n = 5 ans = 'true'

5   Pass
x = 15; n=5 y_correct = 'false'; assert(isequal(Powerof(x,n),y_correct))

n = 5 ans = 'false'

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!