Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- void funkcija(int n, int * niza) {
- int nova_niza[n];
- int k = 0;
- for(int i = 0; i < n; i++) {
- int brojac = 0;
- for(int j = 0; j < n; j++) {
- if(niza[i] == niza[j]) {
- brojac++;
- }
- }
- if(brojac <= 1) {
- nova_niza[k] = niza[i];
- k++;
- }
- }
- for(int i = 0; i < k; i++) {
- printf("%d ", nova_niza[i]);
- }
- }
- int main(int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i =0 ; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- funkcija(n, niza);
- }
- /*
- {14 12 4 2 1 1 10 12 14 22}
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement