Guest User

Untitled

a guest
Nov 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int p, i = 2;
  9. cin >> p;
  10. while (i < p)
  11. {
  12. if (p%i != 0)
  13. {
  14. i += 1;
  15. }
  16. else
  17. {
  18. cout << "wartosc nie jest liczba pierwsza";
  19. _getch();
  20. break;
  21. }
  22. }
  23. if (i == p)
  24. {
  25. cout << "wartosc jest liczba pierwsza";
  26. _getch();
  27. }
  28.  
  29. }
Add Comment
Please, Sign In to add comment