Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int zisti_prvocislo(int x){
  4. int pocitadlo=0;
  5. int delenie;
  6. int j;
  7. for(j=1;j<=x;j++) {
  8. delenie=x%j;
  9. if (delenie==0) {
  10. pocitadlo++;
  11. if (pocitadlo>2) {
  12. return -1;
  13. break;
  14. }
  15. }
  16. }
  17. if (pocitadlo==2) {
  18. return 1;
  19. }
  20. }
  21.  
  22. int main() {
  23. int z,y,i;
  24. printf("zadaj interval r\n");
  25. scanf("%d %d",&z,&y);
  26. for (i=z;i<=y;i++) {
  27. if (zisti_prvocislo(i)==1) {
  28. printf("%d\n",i);
  29. }
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement