You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
361 B
25 lines
361 B
#include<stdio.h>
|
|
#include<math.h>
|
|
int prime(int num)
|
|
{
|
|
int i, k;
|
|
k = (int)sqrt((double)num);
|
|
for(i = 2; i <= k; i ++)
|
|
if(num % i == 0)
|
|
break;
|
|
if(i > k)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
int main()
|
|
{
|
|
int m, n, x;
|
|
scanf("%d %d", &m, &n);
|
|
for(int i = m; i <= n; i ++)
|
|
{
|
|
x = prime(i);
|
|
if(x == 1 && i != 1)
|
|
printf("%d ", i);
|
|
}
|
|
} |