the program is for generating prime numbers. The input would be how many prime number a user wants from the code.
-----------------------------------------------------------------------------------------------------------------
import java.util.*;
public class primeNUMBERS {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
System.out.println("Enetr the nos of prime numbers");
int number=input.nextInt();
System.out.println("The prime numbers are:");
primenumbers(number);
}
public static void primenumbers(int nos){
int firstnumber=2;
int count=0;
while(count<nos){
for(int divisor=2;divisor<firstnumber/2;divisor++){
if(firstnumber%divisor!=0)
System.out.println("\t"+firstnumber);
firstnumber++;
}
count++;
}
}
}