Net Beans Program to Generate Prime No. upto a Limit



 private void CheckActionPerformed(java.awt.event.ActionEvent evt)
  {                                     
                int N= Integer.parseInt(t1.getText());
                int i,p;
                                  if (N==1)
                                         r.setText("One Is Unique Number");
                                 for (p=2;p<=N;p++)
                   {
                                        for(i=2;i<=p/2;i++)
                                             {
                                                        if(p%i==0)
                                                         break;
                                             }
                                if(i>p/2)
                                r.append(p+"\n");
                   }
  }                                    

    private void ClearActionPerformed(java.awt.event.ActionEvent evt) {                                     
       
        t1.setText("");
        r.setText("");

Comments

Popular posts from this blog

Xtra Care Hospital Bill Generator

Net Beans Program to Check a Number Whether is it Prime or Not.

Net Beans program To Check Whether Given Number is Armsrong no. or not