1
Personal someone could help me in this matter of my exercise list:
Make a program that receives a real number, find and show:
- a) the whole of that number;
- b) the fractional part of that paragraph;
- c) rounding that number.
I do not know how I calculate this, my teacher ordered to use the modf, but it didn’t work, giving a web search I found the following code that when testing it ran perfectly, but I can’t understand the logic that was used.
float numero,inteira,fracao,arred;
printf("Digite um numero real: ");
scanf("%f%*c",&numero);
printf("Parte Inteira : %d \n",(int) numero);
printf("Parte Decimal : %f", numero - ((int)numero));
C is not C# and is not C++.
– Jéf Bueno
the question is about how to do or what the algorithm you found does?
– mercador
How to do,I did not understand how the code works
– Thiago Henrique Domingues