9 October 2013

C# program to reverse a string


 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Enter a String");
            string str = Console.ReadLine();
            int i;
            for (i = str.Length - 1; i >= 0; i--)
            {
                Console.Write(str[i]);
            }
            Console.ReadLine();
        }
    }
}

Output


 



No comments:

Post a Comment