Advertisement
Josif_tepe

Untitled

Aug 24th, 2021
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. int main() {
  5.     int n;
  6.     scanf("%d", &n);
  7.    
  8.     int niza[n];
  9.     for(int i = 0; i < n; i++) {
  10.         scanf("%d", &niza[i]);
  11.     }
  12.     int x;
  13.     scanf("%d", &x);
  14.     int nova_niza[n - 1];
  15.     int m = 0;
  16.     int veke_sme_go_zapisale = 0;
  17.     for(int i = 0; i < n; i++) {
  18.         if(niza[i] == x && veke_sme_go_zapisale == 0) {
  19.             veke_sme_go_zapisale = 1;
  20.         }
  21.         else {
  22.             nova_niza[m] = niza[i];
  23.             m++;
  24.         }
  25.     }
  26.     for(int i = 0; i < m; i++) {
  27.         printf("%d ", nova_niza[i]);
  28.     }
  29. }
  30.  
  31.  
  32. // 1 2 3 4 5
  33. // 1 3 6 10 15
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement