using ...System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 ...{ class Program ...{ static void Main(string[] args) ...{ int n, result; Console.Write("請輸入n(n>0) : "); n = Convert.ToInt16(Console.ReadLine()); result = n_step(n); Console.Write("result : "); Console.WriteLine(result); } public static int n_step(int n) ...{ switch (n) ...{ case 1: return 1; default: return n * n_step(n - 1); } } } }