Converting for loop to while loop
1 view (last 30 days)
Show older comments
Dominic Garcia
on 21 Oct 2020
Commented: Dominic Garcia
on 22 Oct 2020
Need it as quick as possible Please, thanks
0 Comments
Accepted Answer
Asad (Mehrzad) Khoddam
on 21 Oct 2020
for i =1:5
j=1;
k=1;
while j<=5-i
fprintf(' ');
j = j+1;
end
while k<=i
fprintf('*');
k = k+1;
end
fprintf('\n')
end
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!