-
-
Save FottyM/d0d81385669ace84a8a538a048709902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int is_prime(int num) | |
{ | |
if (num <= 1) return 0; | |
if (num % 2 == 0 && num > 2) return 0; | |
for(int i = 3; i < num / 2; i+= 2) | |
{ | |
if (num % i == 0) | |
return 0; | |
} | |
return 1; | |
} | |
int main() | |
{ | |
int x, n; | |
printf("Enter x and n "); | |
scanf("%d %d", &x , &n); | |
for(int i = x+1; i<= x+n; i++ ){ | |
if(is_prime(i)){ | |
printf(" %d", i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment