Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void PRZEDZIAL_LPIERWSZE(int l1, int l2)
- {
- l1++;
- for(;l1<=l2;l1++){
- if(l1<2||l1==1)
- {
- cout<<2<<" ";
- }
- else if(l1==2)
- {
- cout<<3<<" ";
- }
- else if(l1>3&&l1<5)
- {
- cout<<5<<" ";
- }
- else if(l1%2!=0&&l1%3!=0&&l1%5!=0)
- {
- cout<<l1<<" ";
- }
- }
- }
- int main()
- {
- int liczba1;
- int liczba2;
- cout << "Podaj poczatek przedzialu: ";
- cin>>liczba1;
- cout << "Podaj koniec przedzialu: ";
- cin>>liczba2;
- cout<<"Liczby pierwsze znajdujace sie w tym przedziale to: ";
- PRZEDZIAL_LPIERWSZE(liczba1,liczba2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement