MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / main

Method main

Programs/Sieve_Of_Eratosthenes.java:6–22  ·  view source on GitHub ↗
(String args[])

Source from the content-addressed store, hash-verified

4public 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];

Callers

nothing calls this directly

Calls 2

sieve_Of_EratosthenesMethod · 0.95
printMethod · 0.80

Tested by

no test coverage detected