fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a=0,b=0,bottom=-1,plus=0,fail=0,c=2;
  5. scanf("%d", &a);
  6. scanf("%d", &b);
  7. for(;a<b;a++)
  8. {
  9. for(;a>c;c++)
  10. {
  11. if(a%c==0)
  12. fail++;
  13. if(fail>0)
  14. break;
  15. }
  16. if(fail==0&&a!=1)
  17. {
  18. plus+=a;
  19. if(bottom==-1)
  20. bottom=a;
  21. }
  22. c=2;
  23. fail=0;
  24. }
  25. if(plus!=0)
  26. printf("%d \n", plus);
  27. printf("%d", bottom);
  28. return 0;
  29. }
Success #stdin #stdout 0s 4360KB
stdin
7
7
stdout
-1