source code: primefn.c

void prime(int n)
{
int d=2;
while(d<n)
{
if(n%d==0)
{
break;
}
else
d++;
}
if(n==d)
printf(" %d ",n);
}
void main()
{
int k;
clrscr();
printf(" function for prime numbers  2 to 100 \n");
for(k=2;k<100;k++)
prime(k);
getch();
}

 output:

 function for prime numbers  2 to 100

 2 3 5 7 11 13 17 19  23 29  31 37  41 43 47  53 59 61  67 71 73

79 83  89 97