當前位置:編程學習大全網 - 編程軟體 - 用C#編寫程序,輸入壹個數,逆向輸出 如:輸入1234,輸出4321,並計算出輸入的是幾位數?

用C#編寫程序,輸入壹個數,逆向輸出 如:輸入1234,輸出4321,並計算出輸入的是幾位數?

這是我編的程序,看是否符合樓主的要求哈class Program

{

public static void Main(string[] args)

{

string str;

Console.WriteLine("請輸入數字:");

str=Console.ReadLine();

Console.WriteLine("數字轉換後結果:");

for(int i=str.Length-1;i>=0;i--)

{

Console.Write(str[i]);

}

Console.WriteLine();

Console.WriteLine("您輸入的數字位數為{0}",str.Length);

Console.Write("Press any key to continue . . . ");

Console.ReadKey(true);

}

}

  • 上一篇:編程證書有哪些?
  • 下一篇:C++編程,clock置換算法
  • copyright 2024編程學習大全網