Advertisement
Tahevix

Twierdzenie Pitagorasa

Aug 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 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.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApp1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Form1_Load(object sender, EventArgs e)
  21.         {
  22.  
  23.         }
  24.  
  25.         private void button1_Click(object sender, EventArgs e)
  26.         {
  27.             string texta = textBox1.Text;
  28.             string textb = textBox6.Text;
  29.             int a = Convert.ToInt32(texta);
  30.             int b = Convert.ToInt32(textb);
  31.             int c = a * a + b * b;
  32.             double wynikc = Math.Sqrt(c);
  33.             string wynik = Convert.ToString(wynikc);
  34.             MessageBox.Show(wynik);
  35.         }
  36.  
  37.         private void button2_Click(object sender, EventArgs e)
  38.         {
  39.             string textc = textBox2.Text;
  40.             string texta = textBox5.Text;
  41.             int c = Convert.ToInt32(textc);
  42.             int a = Convert.ToInt32(texta);
  43.             int b = c * c - a * a;
  44.             double wynikb = Math.Sqrt(b);
  45.             string wynik = Convert.ToString(wynikb);
  46.             MessageBox.Show(wynik);
  47.         }
  48.  
  49.         private void button3_Click(object sender, EventArgs e)
  50.         {
  51.             string textc = textBox3.Text;
  52.             string textb = textBox4.Text;
  53.             int c = Convert.ToInt32(textc);
  54.             int b = Convert.ToInt32(textb);
  55.             int a = c * c - b * b;
  56.             double wynika = Math.Sqrt(a);
  57.             string wynik = Convert.ToString(wynika);
  58.             MessageBox.Show(wynik);
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement