Advertisement
cunha1

Untitled

Apr 2nd, 2020
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int velicinaPolja = 0;
  7.     for(int i=0;i<=1500;i++) {
  8.         if(i%3==0 || i%7==0) {
  9.             velicinaPolja++;
  10.         }
  11.     }
  12.     int *polje = new int[velicinaPolja];
  13.     int brojacPolja = 0;
  14.     for(int i=0;i<=1500;i++) {
  15.         if(i%3==0 || i%7==0) {
  16.             polje[brojacPolja] = i;
  17.             brojacPolja++;
  18.         }
  19.     }
  20.  
  21.     for(int i=0;i<velicinaPolja;i++) {
  22.         cout << polje[i] << endl;
  23.     }
  24.     delete [] polje;
  25.     return 0;
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement