In C #, as inputs I:
Letter: "A"Length: 5
and I want to output:
"AAAAA"
Is there a more elegant way to do this other than a loop?
You can use the string constructor: new string('A', 5);
new string('A', 5);
You can simply create a character that repeats the string constructor to create a string.
Console.WriteLine(new String('A', 5));
Yes:
String st = new String('A', 5);
See MSDN .