static void Main(string[] args) { int m = 1236578; int[] ms = new int[m.ToString().Length]; Rev(m.ToString().Length, m, ref ms); for (int i = 0; i < m.ToString().Length; i++) Console.Write("{0}", ms[i]); Console.ReadLine(); } private static void Rev(int len, int m, ref int[] ms) { if (m / 10 > 0) { ms[len - m.ToString().Length] = m % 10; Rev(len, m / 10, ref ms); return; } ms[len - m.ToString().Length] = m % 10; }
时间: 2024-11-03 15:19:10