Help with Matlab The question is: The volume V of a sphere depends on its radius
ID: 2079894 • Letter: H
Question
Help with Matlab
The question is: The volume V of a sphere depends on its radius r as follows: . Write a script file that prompts the user to enter a radius, computes the volume, and displays the result.
My answer is:
r = input('Enter a value for the radius of the sphere: ') %prompts user for input
V = (4/3)*pi*(r^3) %outputs the value of the volume
When I try to publish it, it gives me
Error using input
Cannot call INPUT from EVALC.
I can't figure out how to prompt for the radius and be able to publish it.
Explanation / Answer
prompt = 'Enter a value for the radius of the sphere: ';
r = input(prompt);
V = (4/3)*pi*(r^3); %outputs the value of the volume
disp('The volume of the sphere is:')
disp(V)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.