import java.io.*;
class PrimeNumberS // By Steve
{
public static void main(String[] args) throws Exception
{
int i;
BufferedReader bf = new BufferedReader(
new InputStreamReader(System.in));
System.out.println("Enter number:");
int num = Integer.parseInt(bf.readLine());
System.out.println("Prime numbers Are:");
for (i=1; i < num; i++ )
{
int j;
for (j=2; j<i; j++)
{
int n = i%j;
if (n==0)
{
break;
}
}
if(i == j){
System.out.println(+i);
}
}
}
}
Input:10,30,50.
Output:
nice but a boaring program
ReplyDelete