Â
#include <stdio.h>
int main()
{
int start, end, i, flag;
printf("Enter the number to Start: ");
scanf("%d", &start);
printf("Enter the number to End: ");
scanf("%d", &end);
printf("Prime numbers between %d and %d are: ", start, end);
while (start < end)
{
flag = 0;
if (start <= 1)
{
++start;
continue;
}
for (i = 2; i <= start / 2; ++i)
{
if (start % i == 0)
{
flag = 1;
break;
}
}
if (flag == 0)
{
printf("%d ", start);
}
++start;
}
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP