Skip to content

Star triangle · ⁨星星三角形⁩

English

Star triangle

Print a triangle of stars four rows high: one star, then two, then three, then four.

Multiplying a string repeats it: "ab" * 3 is "ababab". Let the loop variable say how many stars each row needs.

中文

星星三角形

打印一个四行高的星星三角形:第一行一颗星,然后两颗、三颗、四颗。

字符串乘以一个数会重复它:"ab" * 3 是 "ababab"。让循环变量决定每一行需要几颗星。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩