inhuman_Arif

Part 2 ques 5

Oct 7th, 2021
850
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. typedef long long ll;
  5. int arr[1000],n,data,j=0;
  6. int* deletekorbo()
  7. {
  8.     static int new_arr[1000];
  9.     for(int i=0;i<n;i++)
  10.     {
  11.         if(arr[i]==data)
  12.             continue;
  13.         else
  14.         {
  15.             new_arr[j]=arr[i];
  16.             j++;
  17.         }
  18.     }
  19.     return new_arr;
  20. }
  21.  
  22. int main()
  23. {
  24.     #ifndef ONLINE_JUDGE
  25.         freopen("input.txt", "r", stdin);
  26.         freopen("output.txt", "w", stdout);
  27.     #endif
  28.  
  29.     cin >> n;
  30.     for(int i=0;i<n;i++)
  31.         cin >> arr[i];
  32.     cin >> data;
  33.     int* ptr = deletekorbo();
  34.     for(int i=0;i<j;i++)
  35.         cout << ptr[i] << ' ';
  36.     cout << endl;
  37.    
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment