View Code of Problem 103

#include<stdio.h>
#include<string.h>
int sushu(int n){
  int i;
  for(i=2;i<n;i++)
	  if(n%i==0)
		  return 0;
	  return 1;
}
int main(){
	int a,b,i,rich;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		rich=0;
		for(i=a;i<=b;i++)
		{
			if(sushu(i))
			  rich++;
		}
		printf("%d\n",rich);		
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 103