import java.io.*;
class PrimeSeries
{
public static void main(String args[])
{
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
int a=0,b=0;
try
{
System.out.println("Enter The Starting Number of Range");
a=Integer.parseInt(bf.readLine());
System.out.println("Enter The Ending Number of Range");
b=Integer.parseInt(bf.readLine());
}
catch(Exception e)
{
e.printStackTrace();
}
int i;
for(i=a;i<=b;i++)
{
int c,d,e=2,f=2;
c=i/2;
while(e<=c)
{
d=i%e;
e++;
if(d==0)
{
f=6;
break;
}
}
if(f<5)
System.out.println(i);
}
}
}
class PrimeSeries
{
public static void main(String args[])
{
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
int a=0,b=0;
try
{
System.out.println("Enter The Starting Number of Range");
a=Integer.parseInt(bf.readLine());
System.out.println("Enter The Ending Number of Range");
b=Integer.parseInt(bf.readLine());
}
catch(Exception e)
{
e.printStackTrace();
}
int i;
for(i=a;i<=b;i++)
{
int c,d,e=2,f=2;
c=i/2;
while(e<=c)
{
d=i%e;
e++;
if(d==0)
{
f=6;
break;
}
}
if(f<5)
System.out.println(i);
}
}
}
Comments
Post a Comment