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

2 visualizaciones (últimos 30 días)
****
*****
******
*******

Respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by