Skip to content

Commit 51a3124

Browse files
committed
Made function for algorithm
1 parent 9464a36 commit 51a3124

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

primalityTest/Sieve of Eratosthenes/SieveOfEratosthenes.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#include <stdio.h>
22

3-
int main()
3+
void sieveOfEratosthenes(int number)
44
{
5-
int number = 100, i, j;
5+
6+
int i, j;
67
int primes[number + 1];
78

89
for (i = 2; i <= number; i++) //populating array with naturals numbers
@@ -35,6 +36,18 @@ int main()
3536
}
3637
}
3738

39+
for (i = 0; i < k; i++)
40+
printf("%d ", result[i]);
41+
42+
printf("\n");
43+
}
44+
45+
int main()
46+
{
47+
int number = 100;
48+
49+
sieveOfEratosthenes(number);
50+
3851
return 0;
3952
}
4053

0 commit comments

Comments
 (0)