Programme for circle parameters calculation
1 回表示 (過去 30 日間)
古いコメントを表示
Progamme that takes radius of a circle as a parameter ie. (function arguments) and computes diameter, circumference and area.
0 件のコメント
回答 (1 件)
Sarvesh Kale
2023 年 3 月 9 日
編集済み: Sarvesh Kale
2023 年 3 月 9 日
please refer the following code
function [Area,circumference,diameter] = calculate(radius)
Area = pi*radius*radius;
circumference = 2*pi*radius ;
diameter = 2*radius ;
end
You need the define the function in a file and the name of the matlab file should be calculate.m, that is the same name as our function. then call the function as below
x = 5;
[A,c,d]=calculate(x);
fprintf("The Area of circle is %f\nCircumference is %f\nDiameter is %f",A,c,d);
I hope this helps your query
Thank you
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!