You are on page 1of 1

using using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Threading.Tasks; System.Windows.Forms;

namespace WindowsFormsApplication9 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double a, b, c, D, x1, x2; a=Convert.ToDouble(textBox1.Text); b=Convert.ToDouble(textBox2.Text); c=Convert.ToDouble(textBox3.Text); if (a == 0) { MessageBox.Show("Bukan Fungsi Kuadrat", "Error", MessageBoxButto ns.OK,MessageBoxIcon.Warning); } else { D = Math.Pow(b, 2) - (4 * a * c); textBox4.Text = D.ToString(); x1 = (-b + Math.Sqrt(D))/2*a; textBox5.Text = x1.ToString(); x2 = (-b - Math.Sqrt(D))/2*a; textBox6.Text = x1.ToString(); } } private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); } } }

You might also like