Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include<cstdio>
  2. #include<cmath>
  3. int main()
  4. {
  5. int i,n,j,a[100],t,p,b;
  6. scanf("%d",&n);
  7.  
  8. for(i=0; i<n; i++)
  9. scanf("%d",&a[i]);
  10.  
  11. for(i=0; i<n; i++)
  12. {
  13. p=0;
  14. b=sqrt(a[i]);
  15. for(j=2; j<=b; j++)
  16. {
  17. if(a[i]%j==0)
  18. {
  19. p=1;
  20. break;
  21. }
  22.  
  23. }
  24. if(p==0)
  25. printf("%d\n",a[i]);
  26.  
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement