$1.94

How can i reverse text in c#?

Ask a question+
1

How can I reverse text in c#?

add comment

1 Answer

0
public static string Reverse( string s )
{
    char[] charArray = s.ToCharArray();
    Array.Reverse( charArray );
    return new string( charArray );
}

or

static void Main(string[] args)  
{  
    Console.WriteLine("Enter a No. to reverse");  
    int Number = int.Parse(Console.ReadLine());  
    int Reverse = 0;  
    while(Number>0)  
    {  
        int remainder = Number % 10;  
        Reverse = (Reverse * 10) + remainder;  
        Number = Number / 10;  
    }  
    Console.WriteLine("Reverse No. is {0}",Reverse);  
    Console.ReadLine();  
}
Gor13666_ 900
add comment

Your Answer