Answer:
The code is written line wise with number. The code is explained by comments, which are written after % sign in bold. Note: Comments are not the part of code.
Step-by-step explanation:
1. mass = input('Enter the mass of cube [kilograms]:'); %First we take mass input and save in variable m
2. if mass <= 0 %Condition for value less than or equal to 0
3. disp('Mass must be greater than zero grams');
4. end
5. if mass > 0
6. density = 19.3*1000; % Calculating Density of gold
7. Volume = mass/density; %Calculating Volume
8. Length = Volume^(1/3); %Calculating Length of edge
9. Length = Length*(39.37); %Conversion to inches
10. fprintf('The length of one side of cube is ');
11. fprintf('%.2f',Length);
12. fprintf(' inches');
13. end