March 17, 2013

Find Prime Number in java

how to determine prime number in java


package prime Algorithm.Testing;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *java practical question
 * @author joseph
 */

/**
 * @author Samsung Galaxy S4
 *
 */
public class PrimeOrNot {

    /**
     * @param args
     */
      static int i,num,flag=0;
   
    public static void main(String[] Lumina) {
        // TODO Auto-generated method stub
   
        System.out.println(" To find prime number in java : enter the integer no:");
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       try {
         num=Integer.parseInt(br.readLine());
    } catch (NumberFormatException phpexp) {
        // TODO Auto-generated catch block
        phpexp.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
       for(i=2;i           if(num%2==0)
           {
               flag=1;break;
           }
       }
       if(flag==1)
           System.out.println("Number is not prime");
       else
           System.out.println("Number is  prime"); 
    }

}
 




http://belazy.blog.com/

March 07, 2013

Regional Office - Consumerfed Information Technology Section Kozhikode


Consumerfed Regional office kozhikode Region IT Section




സീസണൽ റിപ്പോർട്













സീസണൽ റിപ്പോർട്







Contact us @ 8281808025/9



Facebook comments