Advertisement
DasShelmer

6.1.19.1d

Oct 15th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     setlocale(LC_ALL, "Russian");
  6.  
  7.     int i, n;
  8.     cout << "Введите размер массива n: ";
  9.     cin >> n;
  10.     int* arr = new int[n];
  11.     // Простое заполнение массива
  12.     for (i = 0; i < n; i++) {
  13.         arr[i] = i;
  14.     }
  15.     // Вывод массива
  16.     for (i = 0; i < n; i += 2) {
  17.         cout << arr[i]<< " ";
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement