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.Windows.Forms;
- namespace lb17
- {
- public partial class Form1 : Form
- {
- double a,b, d, s,fm,k, f;
- public Form1()
- {
- InitializeComponent();
- }
- public static double Aml(double x, double y)
- {
- double x1, y1;
- x1 = Math.Truncate(x);
- y1 = Math.Truncate(y);
- double result = Math.Sqrt(x1 * x1 + y1 * y1);
- return result;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- listBox1.Items.Clear();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- string z;
- a = Convert.ToDouble(textBox1.Text);
- s = Convert.ToDouble(textBox2.Text);
- f = 0;
- for (double i = 0; i < 10; i++)
- {
- b = (a + s) * i;
- d = (a - s) * i;
- k = Aml(b, d);
- f = f + k;
- z = "f[" + Convert.ToString(i) + "] =" + Convert.ToString(f);
- listBox1.Items.Add(z);
- }
- fm = f / 10;
- listBox1.Items.Add(" ");
- z = "Результат = " + fm;
- listBox1.Items.Add(z);
- }
- private void label3_Click(object sender, EventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment