Created
October 4, 2014 15:22
-
-
Save shohan4556/712cf9ca8108f3cd34de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
main() | |
{ | |
long long int i,j,k,n=2000000,sum=2; | |
int count; | |
for(i=3;i<n;i++){ | |
count=1; // assume that it is prime | |
for(j=2;j<=sqrt(i);j++){ | |
if(i%j==0){ | |
count=0; // it is not prime | |
break; | |
} // end control flow | |
} // end child loop | |
if(count==1) | |
sum=sum+i; | |
} // end parent loop | |
printf("%lld\n",sum); | |
} // end main loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment