C# program to find length of a string
Following program shows you how to find length of a string.
In this program we get string from user and prints the length using .Length
using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine ("Please enter the string:");
string input = Console.ReadLine();
int lengthOfString = input.Length;
Console.WriteLine("Length of the given string is: " + lengthOfString);
}
}
Output:
Please enter the string:
jennifer
Length of the given string is: 8