Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. /* librerie */
  2. #include <iostream>
  3. #include <string>
  4. #include <fstream>
  5. using namespace std;
  6.  
  7. void nprimi();
  8. int main()
  9. {
  10. nprimi();
  11. }
  12. void nprimi() {
  13. fstream file("C:\\Users\\N2_4A\\Desktop\\lvl.txt", ios::out);
  14. bool primo = true;
  15. if (file.is_open())
  16. {
  17. for(int i = 10;i < 1000;i++) {
  18. for(int j = 11; j < 1000;j++) {
  19. if(i % j == 0)
  20. primo = false;
  21. }
  22. if(primo)
  23. file << i << endl;
  24. primo = true;
  25. }
  26. }
  27. file.close();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement