使用C#语言

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void button1_Click(object sender, EventArgs e)
            {
                int n;
                if (int.TryParse(textBox1.Text, out n))
                {
                   //為數字
                     int va = Int32.Parse(textBox1.Text);
                   textBox2.Text = System.Convert.ToString(rfc(va));
                }
                else
                {
                    MessageBox.Show ("請輸入數字");
                }
                
                
            }
            private static double rfc(int g)
            {
                switch (g)
                {
                    case 1:
                        return 1;
                    default:
                        return g * rfc(g - 1);
                }
            }
        }
    }
      

  2.   

                int i, n=100; 
                double sum = 1;
                for (i = 1; i <= n; i++)
                    sum *= i; 
               MessageBox.Show( sum.ToString());
      

  3.   


       double sum = 1; 
       for (int  i = 1; i <= 100; i++) 
         sum *= i; 
        Console.Write(sum);
      

  4.   

    阶乘方法
    http://topic.csdn.net/u/20090716/15/98238CCB-3600-49A6-A81B-E67345F0768A.html
    http://topic.csdn.net/u/20090926/22/1c8f99b7-5222-479d-b68e-5571033087e4.html
      

  5.   

    嗯嗯,用DOUBLE,是地!
    如果不怕麻烦,就将1*2==2*2==4*3==12直到一定位数后,保存为文本,然后再对后续部份重新运算,然后,将文本转化为数字进行相加,再转换成为文本再长都放得下!