Cody

Problem 1025. Divisors of an integer

Solution 2137994

Submitted on 23 Feb 2020 by Eric Mueller
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 = 1; y_correct = 1; assert(isequal(divisor(x),y_correct))

z = 1 ans = 1

2   Pass
x = 12; y_correct = [1 2 3 4 6 12]; assert(isequal(divisor(x),y_correct))

z = 12.0000 6.0000 4.0000 3.0000 2.4000 2.0000 1.7143 1.5000 1.3333 1.2000 1.0909 1.0000 ans = 1 2 3 4 6 12

3   Pass
x = 10; y_correct = [1 2 5 10]; assert(isequal(divisor(x),y_correct))

z = 10.0000 5.0000 3.3333 2.5000 2.0000 1.6667 1.4286 1.2500 1.1111 1.0000 ans = 1 2 5 10

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!