I need to repeat a word using a loop

6 views (last 30 days)
I want to say "Hello" seven times. How can I do it using MATLAB? I know how to do it using numbers but not using words.

Accepted Answer

KALYAN ACHARJYA on 17 Mar 2018
Edited: KALYAN ACHARJYA on 17 Mar 2018
for a=1:7
fprintf('\nHello'); %\n for new line
  1 Comment
Thishan Dharshana Karandana Gamalathge
This is acceptable. However, at the end of last "Hello" the icon ">>" follows.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by