Advertisement
KDOXG

Ex. 7

Oct 25th, 2018
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void main() {
  5.     int n, m=0, i, j, k=0;
  6.     scanf("%d", &n);
  7.     float a, b, *vetor=malloc(n*sizeof(float)), *aux=malloc(n*sizeof(float));
  8.     for (i=0; i<n; i++)
  9.         scanf("%f", &vetor[i]);
  10.    
  11.     for (i=0; i<n; i++)
  12.     {
  13.         for (j=i+1; j<n; j++)
  14.             if (vetor[i] == vetor[j])
  15.                 m++;
  16.         if (m == 0)
  17.         {
  18.             aux[k]=vetor[i];
  19.             k++;
  20.         }
  21.         m=0;
  22.     }
  23.     for (i=k-1; i>=0; i--)
  24.         printf("%f\t", aux[i]);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement