12345678910111213141516171819202122232425262728293031323334353637 |
- #include <stdio.h>
- void removeDuplicates(int arr[], int *size) {
- int i, j, k;
-
- for (i = 0; i < *size; ++i) {
- for (j = i + 1; j < *size;) {
- if (arr[j] == arr[i]) {
- for (k = j; k < *size - 1; ++k) {
- arr[k] = arr[k + 1];
- }
- (*size)--;
- } else {
- ++j;
- }
- }
- }
- }
- int main() {
- int n, i;
- scanf("%d", &n);
-
- int arr[n];
- for (i = 0; i < n; ++i) {
- scanf("%d", &arr[i]);
- }
-
- removeDuplicates(arr, &n);
-
- for (i = 0; i < n; ++i) {
- printf("%d ", arr[i]);
- }
- printf("\n");
-
- return 0;
- }
|