How to write a loop that spells the word “aluminum,” adding one letter at a time?
3 views (last 30 days)
Show older comments
Surajit Deb Barma
on 17 Dec 2015
Commented: Surajit Deb Barma
on 18 Dec 2015
Answer should appear similar to this: a al alu alum alumi alumin aluminu aluminum
0 Comments
Accepted Answer
Stephen23
on 17 Dec 2015
Edited: Stephen23
on 17 Dec 2015
>> S = 'aluminium';
>> for k = 1:numel(S), disp(S(1:k)), end
a
al
alu
alum
alumi
alumin
alumini
aluminiu
aluminium
If you actually want to learn how to write your own MATLAB code and not just get other people to do your homework for you, then you should do these tutorials:
More Answers (0)
See Also
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!