Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //6. Maximum and minimum of three numbers
- 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 min_max
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- //find max button
- int max;
- max = int.Parse(textBox1.Text);
- if (max < int.Parse(textBox2.Text))
- max = int.Parse(textBox2.Text);
- if (max < int.Parse(textBox3.Text))
- max = int.Parse(textBox3.Text);
- textBox4.Text = max.ToString();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- //find min button
- int min;
- min = int.Parse(textBox1.Text);
- if (min > int.Parse(textBox2.Text))
- min = int.Parse(textBox2.Text);
- if (min > int.Parse(textBox3.Text))
- min = int.Parse(textBox3.Text);
- textBox5.Text = min.ToString();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- //reset function
- textBox1.Clear();
- textBox2.Clear();
- textBox3.Clear();
- textBox4.Clear();
- textBox5.Clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement