Based on the first challenge instructions, I wrote the following:
#include <stdio.h>
int main(int argc, const char * argv[])
{
//set two float variables
float cow;
float calf;
//declare double-type variable
double family;
//Assign numbers with decimals to the two floats and assign the double to the sum of the two floats
cow = 2305.8;
calf = 155.1;
family = cow + calf;
//Output using printf
printf("The cow family equals %f.\n", family);
return 0;
}
Oddly, here is the result:
The cow family equals 2460.900146.
Program ended with exit code: 0
What’s the deal with the 146? To test, I even attempted to set the decimals to match the number of spaces with zeroes, and it still returned the same result. Please advise.