Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write the program for prime numbers?

Answer Posted / azka sumbel

namespace prime_381
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int a;
int result;
int i, j;

private void button1_Click(object sender, EventArgs
e)
{

a = Convert.ToInt32(textBox1.Text);
prime();
textBox1.Clear();
textBox1.Focus();

}
int flag;
public void prime()
{
flag = 1;

for (i = 2; i <= a / 2; i++)
{
if (a % i == 0)
flag = 0;
}
if (flag == 1)
MessageBox.Show("Prime.");
else
MessageBox.Show("not Prime");
}
}
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are enumerated types?

1188


what are the 10 different models of writing an addition program in C language?

1894


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3584


Process by which one bit pattern in to another by bit wise operation is?

1159


What is zero based addressing?

1171


What is logical error?

1123


What are the valid places to have keyword “break”?

1089


Why do we use stdio h and conio h?

1084


Do you know the difference between exit() and _exit() function in c?

1062


What is the Purpose of 'extern' keyword in a function declaration?

1077


what will be the output for the following main() { printf("hi" "hello"); }

10999


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

1196


What is masking?

1151


given post order,in order construct the corresponding binary tree

2781


Hi can anyone tell what is a start up code?

2064