Advertisement
Farjana_akter

Untitled

Mar 12th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define x 1000000
  4. bool mark[x+5]={false};
  5. void sieve()
  6. {
  7. int i,j,k=0,isprime[10000];
  8. mark[0]=true;
  9. mark[1]=true;
  10. for(i=2;i*i<=1000000;i++)
  11. {
  12. if(mark[i]==false)
  13. {
  14. for(j=i*i;j<=1000000;j+=i)
  15. {
  16. mark[j]=true;
  17. }
  18. }
  19. }
  20. }
  21. int main()
  22. {
  23. sieve();
  24. long long int n,i,j,k,a,b,c,d,e,f;
  25. while(cin>>n && n)
  26. {
  27. int count=0;
  28. for(i=2;i<=n;i++)
  29. {
  30. if(mark[i]==false)
  31. {
  32. if(n%i==0)
  33. count++;
  34. }
  35. }
  36. cout<<n<<" : "<<count<<endl;
  37. }
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement