Question

Problem #2 .Calculate the volume and surface area of a torus from the minor radius r...

Problem #2 .Calculate the volume and surface area of a torus from the minor radius r and major radius R. The equation for the volume of a torus i:s and the equation for the surface area of a torus is A = 4㎡Ar Your script should read-in values for the minor radius and major radius and display the calculated values with appropriate units. The units should also be read-in. Test your program for the following two cases: . Or-5in and R-15in 2 r 12 mm and R- 75 mm in m. file

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MatLab program

clear all
clc
% minor radius
r=input('enter minor radius r: ');
% major radius
R=input('enter major radius R: ');
% units
fprintf('\n enter 1 if units is in inches');
fprintf('\n enter 2 if units is in mm');
i=input(': ');
A=pi^2*(R^2-r^2);
V=2*pi^2*r^2*R;
if i==1
    fprintf('\n Surface area=%.2f in^2',A);
    fprintf('\n Volume = %.2f in^3',V);
elseif i==2
    fprintf('\n Surface area=%.2f mm^2',A);
    fprintf('\n Volume = %.2f mm^3',V);
end
   

Screenshot

1 clear all 2 clo 3% minor radius 4 r=input(enter minor radius r: ); 5 % major radius 6 R=input(enter major radius R: );

Save the above program and execute it.

Result

>> torus enter minor radius r: 5 enter major radius R: 15 enter 1 if units is in inches enter 2 if units is in mm: 1 Surface

I hope this will help you.

Add a comment
Know the answer?
Add Answer to:
Problem #2 .Calculate the volume and surface area of a torus from the minor radius r...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT