Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int zisti_prvocislo(int x){
- int pocitadlo=0;
- int delenie;
- int j;
- for(j=1;j<=x;j++) {
- delenie=x%j;
- if (delenie==0) {
- pocitadlo++;
- if (pocitadlo>2) {
- return -1;
- break;
- }
- }
- }
- if (pocitadlo==2) {
- return 1;
- }
- }
- int main() {
- int z,y,i;
- printf("zadaj interval r\n");
- scanf("%d %d",&z,&y);
- for (i=z;i<=y;i++) {
- if (zisti_prvocislo(i)==1) {
- printf("%d\n",i);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement