Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 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. b=sqrt(a[i]);
  14. for(j=2; j<=b; j++)
  15. {
  16. if(a[i]%j==0)
  17. p=0;
  18. else
  19. p=1;
  20. }
  21. if(p==1)
  22. printf("%d\n",a[i]);
  23.  
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement