Advertisement
MeehoweCK

Untitled

Dec 6th, 2020
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     int licznik = 0;        // przechowuje ile liczb już zostało wypisanych
  10.     int liczba = 1;         // wypisywana liczba
  11.  
  12.     while(licznik < n)
  13.     {
  14.         if(liczba % 3 == 0 && liczba % 5 == 0)
  15.         {
  16.             cout << liczba << endl;
  17.             ++licznik;
  18.         }
  19.         ++liczba;
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement