輸入一個整數,將其個位數字顛倒順序後輸出
阿新 • • 發佈:2019-02-11
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication2._4 { class Program { static void Main(string[] args) { string str = Console.ReadLine(); char[] strarr = str.ToString().ToCharArray(); StringBuilder sb = new StringBuilder(); for (int i = strarr.Length - 1; i >= 0; i--) { sb.Append(strarr[i]); } Console.WriteLine(sb.ToString()); Console.ReadKey(); } } }