Tuesday 21 February 2017

reverse string example program in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication50
{
    class Program
    {
        static void Main(string[] args)
        {

            string Str, Revstr = "";
            Console.Write("Enter A String : ");
            Str = Console.ReadLine();

            for (int i = Str.Length - 1; i >= 0; i--)
            {

                Revstr = Revstr + Str[i];
            }

            Console.WriteLine("Reverse  String  Is  {0}", Revstr);
            Console.ReadLine();

        }
    }
}

output screenshot:






No comments:

Post a Comment