Advertisement
Guest User

Untitled

a guest
Jan 18th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7. int n=2000000;
  8. long long sum=0;
  9. int m;
  10. int i;
  11. for(i=2;i<n;i++)
  12. {
  13. for(m=2;m<=sqrt(i);m++)
  14. {
  15. if(i%m==0)
  16. {
  17. break;
  18. }
  19. }
  20. if(m>sqrt(i))
  21. sum+=i;
  22. }
  23. printf("%d",sum);
  24. getch();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement