34 lines
690 B
C
34 lines
690 B
C
# include <stdio.h>
|
|
# include <stdlib.h>
|
|
|
|
int main(void) {
|
|
int taille_tab;
|
|
double* tab = (double*) malloc(3*sizeof(double));
|
|
int i;
|
|
int j;
|
|
printf("Combien de réels souhaitez-vous entrer ? ");
|
|
scanf("%d", &taille_tab);
|
|
getchar();
|
|
tab = (double*) realloc(tab, taille_tab*sizeof(double));
|
|
for (i = 0; i != taille_tab; i++) {
|
|
printf("Entrez le %de réel : ", i + 1);
|
|
scanf("%lf", &tab[i]);
|
|
getchar();
|
|
}
|
|
|
|
for (i = 0; i != (taille_tab - 1); i++) {
|
|
for (j = i; j != taille_tab; j++) {
|
|
if (tab[i] == tab[j]) {
|
|
tab[j] = 0.0;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i != taille_tab; i++) {
|
|
if (tab[i] != 0.0) {
|
|
printf("%.3f ", tab[i]);
|
|
}
|
|
}
|
|
putchar('\n');
|
|
return EXIT_SUCCESS;
|
|
} |