(String args[])
| 4 | public class Sieve_Of_Eratosthenes |
| 5 | { |
| 6 | public static void main(String args[]) |
| 7 | { |
| 8 | Scanner sc=new Scanner(System.in); |
| 9 | Sieve_Of_Eratosthenes nm=new Sieve_Of_Eratosthenes(); |
| 10 | int n=sc.nextInt(); |
| 11 | // input taken upto which primes which will be displayed |
| 12 | boolean k[]=nm.sieve_Of_Eratosthenes(n); |
| 13 | // method calling where an integer value is sent and a boolean array is stored as a return value |
| 14 | for(int i=0;i<=20000000;i++) |
| 15 | { |
| 16 | if(k[i]) |
| 17 | { |
| 18 | System.out.print(i+" "); |
| 19 | } |
| 20 | } |
| 21 | System.out.println(); |
| 22 | } |
| 23 | boolean[] sieve_Of_Eratosthenes(int n) |
| 24 | { |
| 25 | boolean b[]=new boolean[n+1]; |
nothing calls this directly
no test coverage detected