Cody

# Problem 2643. Find out base of following arithmetic operation

Solution 3401783

Submitted on 26 Oct 2020 by Nikolaos Nikolaou
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 = '41/3=13'; y_correct = 8; assert(isequal(base_exp(x),y_correct))

s = '21/3==8' ans = logical 0 s = '25/3==9' ans = logical 0 s = '29/3==10' ans = logical 0 s = '33/3==11' ans = logical 1 y = 8

2   Pass
x = '23+44+14+32=223'; y_correct = 5; assert(isequal(base_exp(x),y_correct))

s = '13+24+9+17==63' ans = logical 1 y = 5

3   Pass
x = '41^(1/2)=5'; y_correct = 6; assert(isequal(base_exp(x),y_correct))

s = '25^(1/2)==5' ans = logical 1 y = 6

4   Pass
x = '302/20=12.1'; y_correct = 4; assert(isequal(base_exp(x),y_correct))

y = 4

5   Pass
x = '6*9=42'; y_correct = 13; assert(isequal(base_exp(x),y_correct))

s = '6*9==42' ans = logical 0 s = '6*9==46' ans = logical 0 s = '6*9==50' ans = logical 0 s = '6*9==54' ans = logical 1 y = 13

### Community Treasure Hunt

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

Start Hunting!