محاسبه عدد e
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace e
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double ee = 1;
int f = 1;
for (int i = 1; i <= Int32.Parse(textBox1.Text); i++)
{
f = f * i;
ee = ee + (double)1 / f;
}
textBox2.Text = ee.ToString();
}
}
}
+ نوشته شده در یکشنبه نهم تیر ۱۳۸۷ ساعت 2:59 توسط رضا امیرخانی
|