How to create a string with a repeated character N times in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main(string[] args)
    {
        string repeated = new string('*', 10); // Repeats '*' 10 times
        
        Console.WriteLine(repeated);
    }
}




/*
run:

**********

*/

 



answered Jul 28, 2025 by avibootz
...