Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main() {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- int x;
- scanf("%d", &x);
- int nova_niza[n - 1];
- int m = 0;
- int veke_sme_go_zapisale = 0;
- for(int i = 0; i < n; i++) {
- if(niza[i] == x && veke_sme_go_zapisale == 0) {
- veke_sme_go_zapisale = 1;
- }
- else {
- nova_niza[m] = niza[i];
- m++;
- }
- }
- for(int i = 0; i < m; i++) {
- printf("%d ", nova_niza[i]);
- }
- }
- // 1 2 3 4 5
- // 1 3 6 10 15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement