In the following lines of code, the Miracle C compiler will not compile the line of code in the center (float x = 1/a;). Why does this occur?
How can it be corrected?
int a = 3;
float x = 1/a;
printf("The value in x is: %f",x);
In some of the compilers the integer division returns an integer and hence cannot be stored in a float variable and to correct this you need to change the second line here with "float x=1.0/a;". Adding ".0" to 1 will make a difference.