Cody

# Problem 2051. is the number happy?

Solution 1472992

Submitted on 28 Mar 2018 by Gareth Lee
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
n = 1; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 1 b = 1

2   Pass
n = 2; y_correct = 0; assert(isequal(ishappy(n),y_correct))

b = 4

3   Pass
n = 31; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 10 b = 1

4   Pass
n = 13; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 10 b = 1

5   Pass
n = 11; y_correct = 0; assert(isequal(ishappy(n),y_correct))

b = 2 b = 4

6   Pass
n = 101; y_correct = 0; assert(isequal(ishappy(n),y_correct))

b = 2 b = 4

7   Pass
n = 100; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 1 b = 1

8   Pass
n = 130; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 10 b = 1

9   Pass
n = 230; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 13 b = 10 b = 1

10   Pass
n = 190; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 82 b = 68 b = 100 b = 1

11   Pass
n = 290; y_correct = 0; assert(isequal(ishappy(n),y_correct))

b = 85 b = 89

12   Pass
n = 998; y_correct = 1; assert(isequal(ishappy(n),y_correct))

b = 226 b = 44 b = 32 b = 13 b = 10 b = 1

### Community Treasure Hunt

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

Start Hunting!