Vla_DOS

1

Jul 1st, 2022
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     setlocale(0, "");
  8.     int n = 0, a = 0, d = 0;
  9.     cout << "Введіть розмір масиву: ";
  10.     cin >> n;
  11.     int* arr = new int[n];
  12.  
  13.     cout << "\na = ";
  14.     cin >> a;
  15.     arr[0] = a;
  16.     cout << "\nd = ";
  17.     cin >> d;
  18.     for (int i = 1; i < n; i++) {
  19.         arr[i] = arr[i - 1] * d;
  20.     }
  21.     for (int i = 0; i < n; i++) {
  22.         cout << arr[i] << "\t";
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment