View Code of Problem 27

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

return 0;
}
/*
Main.c: In function 'main':
Main.c:5:3: error: 'sum' undeclared (first use in this function)
   sum = 0;
   ^
Main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
*/

Double click to view unformatted code.


Back to problem 27