Cody

# Problem 142. give nth decimal place of pi

Solution 368590

Submitted on 11 Dec 2013 by Robert
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 = 13; y_correct = 7; assert(isequal(pi_digit(x),y_correct))

div = 0.1416 div = 0.4159 div = 0.1593 div = 0.5927 div = 0.9265 div = 0.2654 div = 0.6536 div = 0.5359 div = 0.3590 div = 0.5898 div = 0.8979 div = 0.9793 div = 0.7931 y = 7

2   Pass
%% x = 14; y_correct = 9; assert(isequal(pi_digit(x),y_correct))

div = 0.1416 div = 0.4159 div = 0.1593 div = 0.5927 div = 0.9265 div = 0.2654 div = 0.6536 div = 0.5359 div = 0.3590 div = 0.5898 div = 0.8979 div = 0.9793 div = 0.7931 div = 0.9312 y = 9

3   Pass
%% x = 15; y_correct = 3; assert(isequal(pi_digit(x),y_correct))

div = 0.1416 div = 0.4159 div = 0.1593 div = 0.5927 div = 0.9265 div = 0.2654 div = 0.6536 div = 0.5359 div = 0.3590 div = 0.5898 div = 0.8979 div = 0.9793 div = 0.7931 div = 0.9312 div = 0.3116 y = 3

### Community Treasure Hunt

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

Start Hunting!