public partial class Form1 : Form
{
int[] a = new int[4];
int result;
int temp, max;
public Form1()
{
InitializeComponent();
groupBox2.Visible = false;
this.MaximizeBox = false;
this.MinimizeBox = false;
}
private void operationbtn_Click(object sender, EventArgs e)
{
a[0]=Convert.ToInt16(inputtxt1.Text);
a[1] = Convert.ToInt16(inputtxt2.Text);
a[2] = Convert.ToInt16(inputtxt3.Text);
a[3] = Convert.ToInt16(inputtxt4.Text);
max=4;
for (int u = 0; u < max; u++)
{
for (int i = 0; i < max - 1; i++) //Loop for the array for the sorting
{
if (a[i] > a[i + 1])
{
temp = a[i];
a[i] = a[i + 1];
a[i + 1] = temp;
}
}
}
groupBox2.Visible = true;
Outputtxt1.Text = Convert.ToString(a[0]);
Outputtxt2.Text = Convert.ToString(a[1]);
Outputtxt3.Text = Convert.ToString(a[2]);
Outputtxt4.Text = Convert.ToString(a[3]);
}
}
{
int[] a = new int[4];
int result;
int temp, max;
public Form1()
{
InitializeComponent();
groupBox2.Visible = false;
this.MaximizeBox = false;
this.MinimizeBox = false;
}
private void operationbtn_Click(object sender, EventArgs e)
{
a[0]=Convert.ToInt16(inputtxt1.Text);
a[1] = Convert.ToInt16(inputtxt2.Text);
a[2] = Convert.ToInt16(inputtxt3.Text);
a[3] = Convert.ToInt16(inputtxt4.Text);
max=4;
for (int u = 0; u < max; u++)
{
for (int i = 0; i < max - 1; i++) //Loop for the array for the sorting
{
if (a[i] > a[i + 1])
{
temp = a[i];
a[i] = a[i + 1];
a[i + 1] = temp;
}
}
}
groupBox2.Visible = true;
Outputtxt1.Text = Convert.ToString(a[0]);
Outputtxt2.Text = Convert.ToString(a[1]);
Outputtxt3.Text = Convert.ToString(a[2]);
Outputtxt4.Text = Convert.ToString(a[3]);
}
}
No comments:
Post a Comment