Star Triangle
Use a for loop to print a right triangle made of * characters. Each line should have one more star than the last.
Expected output:
text
* ** *** **** *****
Hints:
- Use
for i in 1..=5to loop 5 times - The
.repeat()method can repeat a string:"*".repeat(3)gives*** - Print
"*".repeat(i)on each line — butineeds to be the right type! - Use
"*".repeat(i as usize)if needed to convert the number type
rust
fn main() {
}