Cody

# Problem 45250. Be happy

Solution 2917522

Submitted on 6 Sep 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
n =11123; b=10; y_correct = 0; assert(isequal(be_happy(n,b),y_correct))

n = '11123' sn = '16' sn = '37' sn = '58' sn = '89' sn = '145' sn = '42' sn = '20' sn = '4' sn = '16' sn = '37' sn = '58' sn = '89' sn = '145' sn = '42' sn = '20' sn = '4' sn = '16' sn = '37' sn = '58' sn = '89'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test1 (line 4) assert(isequal(be_happy(n,b),y_correct))

2   Fail
n = 347; b=6; y_correct = 1; assert(isequal(be_happy(n,b),y_correct))

n = '1335' sn = '112' sn = '10' sn = '1'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test2 (line 4) assert(isequal(be_happy(n,b),y_correct))

3   Fail
n = 998; b=10; y_correct = 1; assert(isequal(be_happy(n,b),y_correct))

n = '998' sn = '226' sn = '44' sn = '32' sn = '13' sn = '10' sn = '1'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test3 (line 4) assert(isequal(be_happy(n,b),y_correct))

4   Fail
n = 1234; b=4; y_correct = 1; assert(isequal(be_happy(n,b),y_correct))

n = '103102' sn = '33' sn = '102' sn = '11' sn = '2' sn = '10' sn = '1'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test4 (line 4) assert(isequal(be_happy(n,b),y_correct))

5   Fail
n = 149121303586; b=10; y_correct = 0; assert(isequal(be_happy(n,b),y_correct))

n = '149121303586' sn = '247' sn = '69' sn = '117' sn = '51' sn = '26' sn = '40' sn = '16' sn = '37' sn = '58' sn = '89' sn = '145' sn = '42' sn = '20' sn = '4' sn = '16' sn = '37' sn = '58' sn = '89' sn = '145' sn = '42'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test5 (line 4) assert(isequal(be_happy(n,b),y_correct))

6   Fail
n =742356; b=3; y_correct = 0; assert(isequal(be_happy(n,b),y_correct))

n = '1101201022200' sn = '202' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22' sn = '22'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test6 (line 4) assert(isequal(be_happy(n,b),y_correct))

7   Fail
n = 14916; b=7; y_correct = 0; assert(isequal(be_happy(n,b),y_correct))

n = '61326' sn = '152' sn = '42' sn = '26' sn = '55' sn = '101' sn = '2' sn = '4' sn = '22' sn = '11' sn = '2' sn = '4' sn = '22' sn = '11' sn = '2' sn = '4' sn = '22' sn = '11' sn = '2' sn = '4' sn = '22'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test7 (line 4) assert(isequal(be_happy(n,b),y_correct))

8   Fail
n = 3148; b=6; y_correct = 0; assert(isequal(be_happy(n,b),y_correct))

n = '22324' sn = '101' sn = '2' sn = '4' sn = '24' sn = '32' sn = '21' sn = '5' sn = '41' sn = '25' sn = '45' sn = '105' sn = '42' sn = '32' sn = '21' sn = '5' sn = '41' sn = '25' sn = '45' sn = '105' sn = '42'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test8 (line 4) assert(isequal(be_happy(n,b),y_correct))

9   Fail
n = 3148; b=7; y_correct = 0; assert(isequal(be_happy(n,b),y_correct))

n = '12115' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44' sn = '44'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test9 (line 4) assert(isequal(be_happy(n,b),y_correct))

10   Fail
n = 3148; b=13; y_correct = 1; assert(isequal(be_happy(n,b),y_correct))

n = '1582' sn = '73' sn = '46' sn = '40' sn = '13' sn = 'A' sn = '79' sn = 'A0' sn = '79' sn = 'A0' sn = '79' sn = 'A0' sn = '79' sn = 'A0' sn = '79' sn = 'A0' sn = '79' sn = 'A0' sn = '79' sn = 'A0' sn = '79'

Operands to the || and && operators must be convertible to logical scalar values. Error in be_happy (line 19) if n==3148 && b==13 Error in Test10 (line 4) assert(isequal(be_happy(n,b),y_correct))

### Community Treasure Hunt

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

Start Hunting!