Advertisement
Josif_tepe

Untitled

Dec 16th, 2023
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void funckija(int * niza, int n, int x) {
  5.     for(int i = 0; i < n; i++) {
  6.         *(niza + i) = x;
  7.     }
  8.  
  9. }
  10. int main() {
  11.     int n;
  12.     cin >> n;
  13.     int niza[n];
  14.     for(int i = 0 ; i< n; i++) {
  15.         cin >> niza[i];
  16.     }
  17.    
  18.     int x;
  19.     cin >> x;
  20.     funckija(niza, n, x);
  21.     for(int i = 0; i < n; i++) {
  22.         cout << niza[i] << " ";
  23.     }
  24.     return 0;
  25. }
  26. /*
  27.  5
  28.  1 2 3 4 5
  29.  5
  30.  **/
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement