#include <stdio.h>
#include <stdlib.h>
#define arr 10
/*
5. Dado un vector de m laiListmentos, escriba un programa para obtener otro vector con los laiListmentos diferentes del primer vector extrayendo los laiListmentos repetidos.
Ejemplo: Si el vector original es: 2, 3, 5, 3, 7, 8, 3, 3, 9 , entonces el nuevo será:
2, 3, 5, 7, 8, 9
*/
short red( int num, int * ar) ;
int main( void ) {
int laiList[ arr] = { 0 } , laiRes[ arr] = { 0 } , liAcc= 0 ;
short count= 0 ;
while ( count< arr) {
printf ( "Please input a number :" ) ; scanf ( "%d\n " , & laiList
[ count
] ) ; count++;
}
count= 0 ;
while ( count< arr) {
if ( red( laiList[ count] , laiList) == 0 ) {
laiRes[ liAcc] = laiList[ count] ;
liAcc++;
}
count++;
}
count= 0 ;
while ( count< liAcc) {
count++;
}
}
short red( int num, int * ar) {
short acc= 0 ;
short count= 0 ;
while ( count< arr) {
if ( ar[ count] == num)
acc++;
count++;
}
return acc;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2RlZmluZSBhcnIgMTAKLyoKNS4gRGFkbyB1biB2ZWN0b3IgZGUgbSBsYWlMaXN0bWVudG9zLCBlc2NyaWJhIHVuIHByb2dyYW1hIHBhcmEgb2J0ZW5lciBvdHJvIHZlY3RvciBjb24gbG9zIGxhaUxpc3RtZW50b3MgZGlmZXJlbnRlcyBkZWwgcHJpbWVyIHZlY3RvciBleHRyYXllbmRvIGxvcyBsYWlMaXN0bWVudG9zIHJlcGV0aWRvcy4KRWplbXBsbzogU2kgZWwgdmVjdG9yIG9yaWdpbmFsIGVzOiAgMiwgMywgNSwgMywgNywgOCwgMywgMywgOSAsIGVudG9uY2VzIGVsIG51ZXZvIHNlcsOhOgoJMiwgMywgNSwgNywgOCwgOQoqLwpzaG9ydCByZWQoaW50IG51bSwgaW50ICphcik7CmludCBtYWluKHZvaWQpCXsKCWludCBsYWlMaXN0W2Fycl09ezB9LCBsYWlSZXNbYXJyXT17MH0sIGxp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