5
Good evening, I would like to know how I can print the fractional part of the real number, that is, when I type 5.678, I would like to print in the second A(where this comment), only the number 0.678, what I should use for printing, I did not find in Math. there is one that solves the problem. Thank you.
#include <stdio.h>
int main (void)
{
float A;
scanf("%f", &A);
A = ceil(A);
A = ;//Impressão nesta linha da parte fracionaria
A = floor(A);
printf("%f\n%.0f\n%f", A, A, A);
return 0;
}
Note, however, that your
printf
end will not give the result you expect. You use the same variable to store different values, but its output will have the same value repeated three times (which will be the value of the last assignment toA
, that is, the value offloor(A)
). Use different variables to receive and store the results of operations onA
.– Luiz Vieira