Write a program in C# Sharp to find the length of a string without using library function


using System;

class Program
{
    //How to Write a program in C# Sharp to find the length of a string without using library function.
    static void Main()
    {
       string str="Hello";
       int l = 0;
     
       foreach(char c in str)
       {
           l=l+1;
       }
     
       Console.Write("Length: {0}", l);
     
    }
}



0 Comments