实现输出:a bbb ccccc ddddddd fffffffff
时间: 2023-05-15 19:05:41 浏览: 461
c语言输出一串字符串
可以使用循环和字符串拼接来实现这个输出:
```
string[] letters = {"a", "b", "c", "d", "f"};
int[] counts = {1, 3, 5, 7, 9};
string output = "";
for (int i = 0; i < letters.Length; i++) {
output += letters[i] + new string(letters[i][0], counts[i]) + " ";
}
Console.WriteLine(output);
```
输出结果为:a bbb ccccc ddddddd fffffffff
阅读全文