fork(2) download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3.  
  4. int prime(int p) {
  5. int j = 2;
  6. int r = sqrt(p);
  7. if (p == 1) return 0;
  8. for (int j = 2; j <= r; ++j)
  9. if (p % j == 0)
  10. return 0;
  11. return 1;
  12. }
  13.  
  14. int main() {
  15. int n, m, p, t;
  16.  
  17. scanf("%d", &t);
  18. for (int i = 0; i<t; ++i)
  19. {
  20. scanf("%d %d", &m, &n);
  21. for (p = m; p <= n; ++p)
  22. {
  23. if (prime(p)) printf("%d\n", p);
  24. }
  25. }
  26. return 0;
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
3
1 10
3 5
compilation info
prog.cpp: In function 'int prime(int)':
prog.cpp:6:19: error: 'sqrt' was not declared in this scope
     int r = sqrt(p);
                   ^
stdout
Standard output is empty