输入一个整数,将其个位数字颠倒顺序后输出

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();
        }
       
            
    }
}

你可能感兴趣的:(C#)