Display inserted string in reverse without using inbuilt function.

Hello,

Below program is for display inserted string in reverse. Hope you will enjoy.

//Display string in Reverse
    class Program
    {
        static void Main(string[] args)
        {
            string s = "";
            Console.WriteLine("Enter string");
            s = Console.ReadLine();
            string final = "";
            for (int i = s.Count()-1; i >= 0; i--)
            {
               final += s[i];
            }
            Console.Write(final);
            Console.ReadLine();
        }
    }

   If input="Hello Program"
   Output: margorP olleH

No comments:

Post a Comment

Please let me know if you have any feedback or doubts.

Jagged Array

What is Jagged Array? Jagged array is called as "array of arrays". when you need a data inside your array element at that time you...