Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int suma = 0;
- int licznik = 0;
- int liczba = 1;
- do
- {
- if(liczba % 10 == 2 || liczba % 10 == 3 || liczba % 10 == 9)
- {
- suma += liczba;
- ++licznik;
- }
- ++liczba;
- } while(licznik < n);
- // UWAGA: Pętla do (w przeciwieństwie do pętli while) wykonuje się ZAWSZE przynajmniej raz
- cout << suma << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement