Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

public void prime()

{ •1 Form1

i nt max= 0;
for ( int i= 1; i <= 25; i++)
{
int C = 0;
for (int j = 1; j <= i; j++) sumbit
{
if (i % j == 0 )
{
c++;
X
}
}
if ( c == 2) 23

{
if ( i > max) OK
{
max = i;
}
}
}
MessageBox .Show(max. ToString()) ;
}
private void buttonl_Click (object sender, EventArgs e)
{
prime() ;
}
}
public void ascend {)
{
int[) a= { 7, 3, 2, 6, 5 };
int t;
for (i nt i= 0; i < a.Length; i++ ) sumbit
{
for ( int j = i + 1; j < a.Length; j++)
{
i f (a[i) > a [j) )
{ 2 ,3 ,5 ,6 ,7,
t = a[i);
a[ i) = a[j];
a[ j) = t;
}
}
richTextBoxl.AppendText (a[i) + ", " ) ;
}
}
private void butt onl_Click(object sender, EventArgs
{
ascend () ;
}
}

You might also like