Write a function that prints the area and circumference of a circle for a given radius. Only the radius is passed to the function. The function does not return any values. The area is given by π r2 and the circumference is 2 π r
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:6| Question number:7.6
All Answers
total answers (1)
printAreaCirc.m
function printAreaCirc(rad)
% Prints the radius, area, and circumference
% of a circle
% Format of call: printAreaCirc(radius)
% Does not return any values
fprintf('For a circle with a radius of %.1f,\n', rad)
fprintf(' the area is %.1f and the circumference is %.1f\n',...
pi*rad*rad, 2*pi*rad)
end
need an explanation for this answer? contact us directly to get an explanation for this answer