Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- /*2.2400 sek */
- int main () {
- unsigned long long i=0;
- unsigned long long j=0;
- int primecount=1;
- int markercount=0;
- DWORD dwStartTime = GetTickCount();
- DWORD dwElapsed;
- for (i=3;i>0;i+=2) {
- if (primecount == 10001) break;
- for (j=2;j<=i;j++) {
- if (i%j==0 && i!=j) break;
- if (j > i/4) {j=i;primecount++;}
- }
- }
- printf("Primecount is %d. And the prime number is: %d\n", primecount, i-2);
- dwElapsed = GetTickCount() - dwStartTime;
- printf("It took %d.%3d seconds to complete\n", dwElapsed/1000, dwElapsed - dwElapsed/1000);
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment