Developpement/23DEV1.1/TPS1/TP2/18-AllocationDynamique/Singletons.c

33 lines
582 B
C
Raw Normal View History

2024-12-09 11:53:11 +01:00
#include <stdlib.h>
#include <stdio.h>
int main(void) {
int num;
int i, j;
double comp;
double in;
int doublon;
printf("Combien de réel à rentrée ? ");
scanf("%d", &num);
double* tab = (double*) calloc(num, sizeof(double));
for(i=0;i<num;i++){
printf("case %d : ", i);
scanf("%lf", tab+i);
printf("\n");
}
for(i=0;i<num;i++){
doublon = 0;
comp=tab[i];
for(j=0;j<num;j++){
if((*(tab+i) == *(tab+j) && (tab+i) != (tab+j))){
doublon = 1;
}
}
if(doublon == 0){
printf("%.2lf ", comp);
}
}
printf("\n");
free(tab);
return EXIT_SUCCESS;
}