1、阶乘的递归算法
using System; namespace JieCheng{ class JC{ public int cal(int num){ int ans=num==1?num:num*cal(num-1); return ans; } } class JCMain{ static void Main(string[] args){ JC jc = new JC(); int result=jc.cal(3); Console.WriteLine("{0}",result); Console.ReadKey(); } } }