35 lines
541 B
C
35 lines
541 B
C
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
int main(void) {
|
||
|
int x;
|
||
|
int i;
|
||
|
int j;
|
||
|
int v;
|
||
|
double r;
|
||
|
|
||
|
printf("Combien de reels voulez vous rentrer? ");
|
||
|
scanf("%d", &x);
|
||
|
double* tab = calloc(x,sizeof(double));
|
||
|
for(i=0;i<x;i++){
|
||
|
v=0;
|
||
|
printf("\nVeuillez saisir le reel numero %d: ",i+1);
|
||
|
scanf("%lf", &r);
|
||
|
if(i>0){
|
||
|
for(j=i-1;j>=0;j--){
|
||
|
if(r==*(tab+j)){
|
||
|
v=1;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
} else{
|
||
|
*(tab+i)=r;
|
||
|
} if (v==0){
|
||
|
*(tab+i)=r;
|
||
|
}
|
||
|
} for(i=0;i<x;i++){
|
||
|
printf("%lf ",*(tab+i));
|
||
|
} putchar('\n');
|
||
|
|
||
|
return 0;
|
||
|
}
|