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
Physics,
7 months ago
Social Sciences,
7 months ago
Biology,
1 year ago
Math,
1 year ago
Social Sciences,
1 year ago
Science,
1 year ago