Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<stdint.h>
  4. int main()
  5. {
  6.  
  7. int64_t total=2;
  8. int counter;
  9.  
  10. for(int i=3;i<2000000;i+=2)
  11. {
  12.  
  13. counter = 0;
  14. for(int j=2;j<=sqrt(i);j++)
  15. {
  16.  
  17. if(i%j==0)
  18. {
  19. counter++;
  20. break;
  21. }
  22.  
  23.  
  24. }
  25.  
  26. if(counter==0)
  27. {
  28. total=total+i;
  29. }
  30. }
  31. printf("%lld",total);
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement