#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, i, j, flag;
printf("Enter
the starting range and ending ragne for prime numbers:\n");
scanf("%d%d",&a,&b);
printf("prime
numbers between %d to %d are:\n", a, b);
for(i=a+1; i<b; ++i)
{
flag=0;
for(j=2; j<=i/2; ++j)
{
if(i%j==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("%d\t", i);
}
printf("\n");
getch();
}
Kaynak: http://www.hdinfoworld.com
bayraktan sonra gelen break ne işe yarar?
YanıtlaSil