write a program to print alternate prime numbers till 20
Answers
Answered by
18
#include <stdio.h>
int main()
{
int a,b,c,d;
printf("prime from a,b : ");
scanf("%d%d", &a,&b);
for (c = a; c <= b; c++)
{
for(d = 2; d < c; d++)
{
if (c % d == 0)
break;
}
if (d == c)
printf("%d ", c);
}
return 1;
}
int main()
{
int a,b,c,d;
printf("prime from a,b : ");
scanf("%d%d", &a,&b);
for (c = a; c <= b; c++)
{
for(d = 2; d < c; d++)
{
if (c % d == 0)
break;
}
if (d == c)
printf("%d ", c);
}
return 1;
}
Similar questions