Answer comes wrong when using decimal places!
I'm running the following program:
#include<stdio.h>
#include<math.h>
main()
{
float x,y,div;
printf("Enter two numbers x,y \n");
scanf("%f%f",&x, &y);
div=x/y;
printf("div=%12.10f\n",div;
return 0;
}
After running, when I put x=1 and y=3 then answer comes 0.3333333433, but answer should be 0.3333333333. Why this error comes ? How can I get rid from this kind of error ? Please help.
Aucun commentaire:
Enregistrer un commentaire