Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. int czy_pierwsza(int d)
  5. {
  6. int i;
  7. for (i=2; i<d/2; i++)
  8. {
  9. if(!(d%i))
  10. return 0;
  11. }
  12. return 1;
  13. }
  14.  
  15. int main()
  16. {
  17. int n, d;
  18. printf("Podaj liczbe: ");
  19. scanf("%d", &n);
  20.  
  21. for(d=2;d<(n/2);d++)
  22. {
  23. if((n%d == 0) && czy_pierwsza(d))
  24. printf("%d\n", d);
  25. }
  26. getch();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement