Saturday 2 December 2017

C# Program to Reverse a String without using Reverse function


Code:

using System;
class Program
{
    static void Main(string[] args)
    {
        string Str, reversestring = "";
        int Length;
        Console.Write("Enter A String : ");
        Str = Console.ReadLine();
        Length = Str.Length - 1;
        while (Length >= 0)
        {
            reversestring = reversestring + Str[Length];
            Length--;
        }
        Console.WriteLine("Reverse  String  Is  {0}", reversestring);
        Console.ReadLine();
    }
}


Output:

Enter a String : sanfoundry
Reverse String is : yrdnuofnas


More C# Programs:


















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...