Cody

Problem 303. Convert Hard Drive marketing sizes to actual data sizes

Solution 2848392

Submitted on 18 Aug 2020 by Ramesh Kumar V
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
a = 100; u = 'MB'; y_correct = 95.4; assert(isequal(convert(a,u),y_correct))

a1 = 0.9540 a2 = 0.9310 z = logical 1 y = 95.4000

2   Pass
a = 10; u = 'GB'; y_correct = 9.31; assert(isequal(convert(a,u),y_correct))

a1 = 0.9540 a2 = 0.9310 z = logical 0

3   Pass
a = 500; u = 'GB'; y_correct = 465.5; assert(isequal(convert(a,u),y_correct))

a1 = 0.9540 a2 = 0.9310 z = logical 0

Suggested Problems

More from this Author39

Community Treasure Hunt

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

Start Hunting!