class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter any String: ");
string input = Console.ReadLine();
string str = "";
for (int i =
input.Length - 1; i >= 0; i--)
{
if (input[i] == ' ')
{
for (int j = str.Length - 1; j >= 0; j--)
{
Console.Write(str[j]);
}
if (i != 0)
{
Console.Write(" ");
str = "";
}
}
else
{
str += input[i];
if (i == 0)
for (int j = str.Length - 1; j >= 0; j--)
{
Console.Write(str[j]);
}
}
}
Console.ReadLine();
}
}
Output:
No comments:
Post a Comment