clc ; clear ; s = 'program '; s (1:3: end ) = s ( end : -3:1); disp ( s ) in matlab

To execute the given code clc; clear; s = 'program '; s(1:3:end) = s(end:-3:1); disp(s) in MATLAB, you can simply write it in a script or the command window.

Here is the code:

main.m
clc;
clear;
s = 'program ';
s(1:3:end) = s(end:-3:1);
disp(s);
63 chars
6 lines

When you run this code, it will output the modified string gpomar.

related categories

gistlibby LogSnag