A Beginners Guide to Fly x Tin PracticeTest C Secure l h moo

A Beginner\'s Guide to Fly x Tin PracticeTest C Secure l h moodle2 uncc.edu/mod/quiz/attem pt.php?attem pt 19461358 page 3 Quick Links Academic Support Moodle 2 Summer Moodle 2 Archive FAQs Canvas Login Christopher Yarrison UNC CHARLOTTE ETGR-2122-001-Spring 2017-Technical Programming Home Spring 2017 ETGR-2122-001-Spring 2017-21137 Topic 5 Practice Test QULZ NAVIGATION Question 4 Write a MATLAB script to calculate the area of a circle using a user defined radius r Your script should have \"input\" and \"disp\" or 1 2 3 4 Not yet answered \"printf\" statements. An example of a simple input statement is: variable input Entera: Not graded Finish attempt F Flag question An example of a simple disp statement is: disp(The answer is Time left 0:27:46 An example of an fprintf statement is: print (\"The answer is: %5.4g n\', x) 3 PM P 2/26/2017

Solution

Solution ::

//////////// To compute the area of a circle from the given input Radiusius //////////////////

function[circum, Area]= circumarea(Radius)
circum=2*pi*Radius;
Area=pi*Radius*Radius;
fprintf(\'Circumference of the circle is %f\ \',circum);
fprintf(\'Area of the circle is %f\ \', Area);
end

///////////////// to find the greater ,lesser,equal area among the circles

Function:

function [area] = CircleArea(Radius)
Area = pi * Radius^2;

Script:

Radius1 = input(\'Enter the Radius of the Circle 1\');
Area1 = CircleArea(Radius1);
disp([\'Area of the Circle1 = \' number2str(Area1)])
Radius2 = input(\'Enter the Radius of the Circle 2\');
Area2 = CircleArea(Radius2);
disp([\'Area of Circle2 = \' number2str(Area2)])
if(Area1 > Area2)
disp(\'Area of the Circle1 is greater than the area of Circle2\');
elseif (Area1 < Area2)
disp(\'Area of the Circle1 is less than thearea of Circle2\');
else
disp(\'Area of the Circle1 is equal to the area of Circle2\');
end

/// *** Thank You *** ///

 A Beginner\'s Guide to Fly x Tin PracticeTest C Secure l h moodle2 uncc.edu/mod/quiz/attem pt.php?attem pt 19461358 page 3 Quick Links Academic Support Moodle

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site