- static void Main(string[] args)
- {
- //接收用户输入的字符串,将其中的字符以与输入相反的顺序输出。
- Console.WriteLine("Give me a string:");
- string mystring = Console.ReadLine();
- string myresult = "";
- for (int i = mystring.Length - 1; i >= 0; i--)
- {
- myresult += mystring[i];//或者myresult += mystring.Substring(i,1);
- }
- Console.WriteLine("The result is {0}:",myresult);
- Console.ReadKey();
- }
转载于:https://blog.51cto.com/864310643/1105721