C# program to find the length of a given string
Program.cs
Console.WriteLine("———————————————————————————————————————————");
Console.WriteLine("Program to find the length of a given string");
Console.WriteLine("———————————————————————————————————————————");
Console.Write("Enter the string ");
string s = Console.ReadLine()!;
Console.WriteLine("\nLength of string is " + s.Length);
Console.WriteLine("———————————————————————————————————————————");
Output
codeaft@codeaft:~/csharp$ dotnet run
———————————————————————————————————————————
Program to find the length of a given string
———————————————————————————————————————————
Enter the string CODEAFT

Length of string is 12
———————————————————————————————————————————
codeaft@codeaft:~/csharp$ 
Comments and Reactions