Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,i,j,flag=1;
  5. scanf("%d",&n);
  6. for(i=1;i<=n;i++)
  7. {
  8. flag=1;
  9. for(j=2;j<=i/2;j++)
  10. {
  11. if(i%j==0)
  12. {
  13. flag=0;
  14. }
  15. }
  16. if(flag==1)
  17. {
  18. printf("%d ",i);
  19. }
  20. }
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement