protected void CheckGivenNumerIsPrimeOrNot()
{
int
number = Convert.ToInt32(textBox1.Text);
int
i;
for
(i = 2; i < number; i++)
{
if
(number % i == 0)
{
MessageBox.Show("Number is
not a prime");
break;
}
}
if(i==number)
{
MessageBox.Show("Number is a
prime");
}
}
No comments :
Post a Comment