How can i reverse text in c#?

Ask a question
1

How can i reverse text in c#?-

Coin iconoffer bounty
add comment

2 Answers

0

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

add comment
0

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();
}

add comment

Your Answer