Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 266478

Submitted on 24 Jun 2013 by James

Correct

14Size
Leading solution size is 12.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
n = 1:10;
d_correct = '1415926535';
assert(isequal(PIdigits(n),d_correct))

                    
2
Pass
 
%%
n = [11:15 25:35];
d_correct = '8979338327950288';
assert(isequal(PIdigits(n),d_correct))

                    
3
Pass
 
%%
n = [1 4 1 5 9 2 6 5 3 5];
d_correct = '1519342919';
assert(isequal(PIdigits(n),d_correct))

                    
4
Pass
 
%%
n = PIdigits(666);
d_correct = '5';
assert(isequal(PIdigits(n),d_correct))

                    
5
Pass
 
%%
n = 10000:-1:9901;
d_correct = '8765736525561010065029518869596522989996384621016485727889425592297560139754672901208824732610065462';
assert(isequal(PIdigits(n),d_correct))

                    
6
Pass
 
%%
n = [7061 319 2770 462 972 8235 6949 3171 9503 345];
d_correct = '0142348015';
assert(isequal(PIdigits(n),d_correct))