protected void CheckGivenNumerIsPrimeOrNot()
{
intnumber = Convert.ToInt32(textBox1.Text);
inti;
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