Clear Filters
Clear Filters

I need to repeat a word using a loop

1 view (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.
Thanks.

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 17 Mar 2018
Edited: KALYAN ACHARJYA on 17 Mar 2018
for a=1:7
fprintf('\nHello'); %\n for new line
end
  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)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!