Q:

Write a C# program to print individual characters of the string in reverse order

0

Write a C# program to print individual characters of the string in reverse order

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
public class StringExercise
{
    public static void Main()
    {
        string str;
        int length = 0;
 
        Console.Write("Enter the string : ");
        str = Console.ReadLine();
 
        length  = str.Length - 1;
        Console.Write("The characters of the string in reverse are : \n");
        while (length >= 0)
        {
            Console.Write("{0} ", str[length]);
            length--;
        }
        Console.ReadLine();
    }
}

Result:

Enter the string : techstudy

The characters of the string in reverse are : 

y d u t s h c e t

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a C# program to copy one string to another s... >>
<< Write a C# program to count a total number of alph...