View Code of Problem 27

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

Double click to view unformatted code.


Back to problem 27