Printing *s as triangles in Java?

后端 未结 21 1916
囚心锁ツ
囚心锁ツ 2020-11-30 11:41

My assignment in my Java course is to make 3 triangles. One left aligned, one right aligned, and one centered. I have to make a menu for what type of triangle and then input

21条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 12:31

    Hint: For each row, you need to first print some spaces and then print some stars. The number of spaces should decrease by one per row, while the number of stars should increase.

    For the centered output, increase the number of stars by two for each row.

提交回复
热议问题