Guest User

Untitled

a guest
Jul 27th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XBasic 1.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace lb17
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         double a,b, d, s,fm,k, f;
  15.         public Form1()
  16.         {
  17.           InitializeComponent();
  18.         }
  19.        
  20.         public static double Aml(double x, double y)
  21.         {
  22.             double x1, y1;
  23.             x1 = Math.Truncate(x);
  24.             y1 = Math.Truncate(y);
  25.             double result = Math.Sqrt(x1 * x1 + y1 * y1);
  26.             return result;
  27.         }
  28.      
  29.         private void button2_Click(object sender, EventArgs e)
  30.         {
  31.             listBox1.Items.Clear();
  32.         }
  33.  
  34.  
  35.  
  36.         private void Form1_Load(object sender, EventArgs e)
  37.         {
  38.  
  39.         }
  40.  
  41.         private void label1_Click(object sender, EventArgs e)
  42.         {
  43.  
  44.         }
  45.  
  46.         private void button1_Click_1(object sender, EventArgs e)
  47.         {
  48.             string z;
  49.             a = Convert.ToDouble(textBox1.Text);
  50.             s = Convert.ToDouble(textBox2.Text);
  51.             f = 0;
  52.             for (double i = 0; i < 10; i++)
  53.             {
  54.                 b = (a + s) * i;
  55.                 d = (a - s) * i;
  56.                 k = Aml(b, d);
  57.                 f = f + k;
  58.                 z = "f[" + Convert.ToString(i) + "] =" + Convert.ToString(f);
  59.                 listBox1.Items.Add(z);
  60.             }
  61.             fm = f / 10;
  62.             listBox1.Items.Add(" ");
  63.             z = "Результат = " + fm;
  64.             listBox1.Items.Add(z);
  65.         }
  66.  
  67.         private void label3_Click(object sender, EventArgs e)
  68.         {
  69.  
  70.         }
  71.     }
  72. }
Add Comment
Please, Sign In to add comment