Write a program to print prime number
You are given two integer inputs x and y. Make a function that takes in x and y as parameters. Then print all the prime numbers which lie between x and y (x and y both inclusive and y>x).
Input Format
First line take an Integer input from user as x.
Second line take an Integer input from user as y.
Constraints
1<=x<=1000
1<=y<=10^4
Output Format
Print all the prime number between given intervals.
Sample Input 0
10
20
Sample Output 0
11 13 17 19
Explanation 0
All prime numbers between 10 to 20 are 11 13 17 19 .
Also Read: Print all unique prime factors
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
static boolean isPrime(int n){
if(n==0 || n==1)
return false;
for(int i=2; i x){
for(int i=x; i<=y; i++){
if(isPrime(i)){
System.out.print(i+" ");
}
}
}
}
}