I want to display the planets name and relative gravity such as: Moon gravity = 0.165 Earth gravity
One of the moderators recommended using a loop for this task. So, I'm trying to see if it's possible to write a code more effeciently using loops without having to print/display each planets one by one. Or is it not possible?
I've been playing around trying to find how to do it with no success, this is by far the closest I've gotten.
NOTE: the vectors are half than it is shown in the example
names = ["Earth"; "Venus"; "Mars"];
val = ["1.0000"; "0.8975"; '0.3915'];
E = append(C, " gravity = ");
I = append(H, " Earth gravity");
fprintf('Grav. Acce.: ');
fprintf('%s \n', J(:,1));