I've made a simple volume of a sphere calculator w/ user input:
clc
%Ask For Radius
radius = input ('What is the radius of your sphere?');
%Calculate Volume Using Radius
vlm = (4/3) * pi * radius^3 ;
%Return Radius
fprintf('The volume of your sphere is %4.2f inches cubed\n', vlm)
But I decided I wanted to go one step further and give the user the option to ask another and another until they don't want to do anymore. However I'm stuck as I can't figure out how to take this user input:
again = input ('Do You Want To Find The Volume Of A Sphere?','s')
And apply it to a conditional such as and if else statement. Here is what I've come up with so far:
if again = yes
%Ask For Radius
%Insert VolumeOfSphere.m
else
fprintf('Ok, Just run Me Again If You Want To Calculate Another Sphere')
%Add An End program Command
end
Any help or tips in the right direction is very much appreciated in advance.
while
– sco1