Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void for_nieparzyste(int a, int b)
- {
- cout << "(FOR) Liczby nieparzyste to: ";
- for(a; a < b; a++ )
- {
- if (a%2!=0)
- cout<< a<<", ";
- }
- }
- int while_nieparzyste(int a, int b)
- {
- cout << "(WHILE) Liczby nieparzyste to: ";
- while (a<b)
- {
- if(a%2!=0)
- cout<< a<<", ";
- a++;
- }
- }
- int dowhile_nieparzyste(int a, int b)
- {
- cout << "(DO WHILE) Liczby nieparzyste to: ";
- do
- {
- if(a%2!=0)
- cout<< a<<", ";
- a++;
- } while (a<b);
- }
- int main()
- {
- cout << "Wprowadz liczby A i B zatwierdzajac je klawiszem RETURN" << endl;
- int a=0, b=0;
- cin >> a >> b;
- for_nieparzyste(a,b);
- cout<<endl;
- while_nieparzyste(a,b);
- cout<<endl;
- dowhile_nieparzyste(a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement