Does anyone knows how to star pattern print trapeze ? like the example below

2 views (last 30 days)
****
*****
******
*******

Answers (1)

Image Analyst
Image Analyst on 19 Jul 2020
So, do you know about fprintf()? You can simply call fprintf() 4 times to make those 4 lines.
  3 Comments
Image Analyst
Image Analyst on 19 Jul 2020
So put fprintf() in a for loop
for k = smallNumber : bigNumber
fprintf(.............)
end
Hint:
>> str = repmat('*', [1, 8])
str =
'********'

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!