Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp5
- {
- public partial class Form1 : Form
- {
- int n = 1;
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- double S = 0;
- double Sk;
- double y;
- double x = Convert.ToDouble(textBox1.Text);
- if (x <= 1 && x >= 0.1f)
- {
- for (int i = 1; i <= 10; i++)
- {
- S+= Math.Pow(x, 2 * i) / (Factorial(2 * i));
- }
- Sk = 1 + S;
- y = (Math.Pow((Math.E),x) + Math.Pow((Math.E), -x)) / 2;
- textBox2.Text = Sk.ToString();
- textBox3.Text = y.ToString();
- }
- else
- {
- MessageBox.Show ("Введите 0.1<=x<=1" );
- }
- }
- static long Factorial(long x)
- {
- return (x == 0) ? 1 : x * Factorial(x - 1);
- }
- static void FuncH(int H, int xn,int xk)
- {
- H = (xk - xn) / 10;
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- }
- private void textBox3_TextChanged(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- textBox1.Text = "";
- textBox2.Text = "";
- textBox3.Text = "";
- }
- private void button3_Click(object sender, EventArgs e)
- {
- Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement