DEV_BUT1/DEV1.1/TP07/chiffre.c

26 lines
403 B
C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
double val1;
double val2;
int unite;
int dixieme;
printf("Donnez un réel : ");
scanf("%lf", &val1);
val2 = val1*10;
val1 = trunc(val1);
unite = (int) val1;
unite= unite%10;
printf("%d\n", unite);
val2 = trunc(val2);
dixieme = (int) val2;
dixieme= dixieme%10;
printf("%d", dixieme);
return EXIT_SUCCESS;
}