The exercise asks that the readings of double
variables be limited to only one decimal place each. I tried to put "%.1lf"
in scanf
, just like we used in printf
, but it did not work.
How could I solve this?
int main(int argc, char** argv) {
double A, B, MEDIA;
do{
printf("Digite A: ");
scanf("%lf", &A);
}while(A<0 || A>10);
do{
printf("Digite B: ");
scanf("%lf", &B);
}while(B<0 || B>10);
MEDIA=(A+B)/2;
printf("MEDIA = %.5lf\n", MEDIA);
return (EXIT_SUCCESS);
}