Try to answer bonus question
2 ビュー (過去 30 日間)
古いコメントを表示
Screenshot is attached. Comment what the code to the bonus question is. Also provide explanations.
0 件のコメント
採用された回答
Birdman
2018 年 2 月 7 日
編集済み: Birdman
2018 年 2 月 7 日
By using primes built in function of MATLAB:
function y=prime_count(n)
y=numel(primes(n));
plot(primes(n))
end
From command line:
prime_count(10)
>> 4
3 件のコメント
Birdman
2018 年 2 月 7 日
It does plot. For instance:
n=10;
plot((1:numel(primes(n)))+1,primes(n),'-o')
and check the attached figure.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!