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
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.