Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool LICZBA_PIERWSZA(int n)
- {
- if(n>1)
- {
- for(int i=2; i<n; i++)
- {
- if(n%i==0)
- {
- return false;
- }
- }
- return true;
- }
- else
- {
- return false;
- }
- }
- void PRZEDZIAL_LPIERWSZE(int x1, int x2)
- {
- bool ok = true;
- for(x1; x1<x2; x1++)
- {
- if(LICZBA_PIERWSZA(x1))
- {
- cout << x1 << " ";
- ok = false;
- }
- }
- if(ok)
- {
- cout << "Nic do pokazania";
- }
- cout << endl;
- }
- int main()
- {
- PRZEDZIAL_LPIERWSZE(1, 14);
- PRZEDZIAL_LPIERWSZE(65, 174);
- PRZEDZIAL_LPIERWSZE(98, 99);
- return 0;
- }
Add Comment
Please, Sign In to add comment