%Let us discuss the function with two paramaters with simple example
%We know the formula for the volume of a cone is p*(1/3)*r^2*h
conevolmain.m
clc;
clear all;
radius = input('Enter the radus of the cone:');
height = input('Enter the height of the cone:');
cv=conevol(radius,height);
fprintf('Volume of the cone with radius %.1f \n and with height %.1f', radius,height);
fprintf('\n is: %.2f'\n,cv);
conevol.m
function out=conevol(radius,height)
out=(pi/3)*radius^2*height;
end
OUTPUT
Enter the radus of the cone:5.6
Enter the height of the cone:6
Volume of the cone with radius 5.6
and with height 6.0
is: 197.04
%We know the formula for the volume of a cone is p*(1/3)*r^2*h
conevolmain.m
clc;
clear all;
radius = input('Enter the radus of the cone:');
height = input('Enter the height of the cone:');
cv=conevol(radius,height);
fprintf('Volume of the cone with radius %.1f \n and with height %.1f', radius,height);
fprintf('\n is: %.2f'\n,cv);
conevol.m
function out=conevol(radius,height)
out=(pi/3)*radius^2*height;
end
OUTPUT
Enter the radus of the cone:5.6
Enter the height of the cone:6
Volume of the cone with radius 5.6
and with height 6.0
is: 197.04
Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com