#include <stdio.h>
int main(int argc, const char * argv[])
{
// Declare variables
float a = 3.14;
float b = 42.0;
double addition = a + b;
printf("The sum is: %f . \n", addition);
return 0;
}
I got confused because in the book it mentions /n and that it would be talked about later. However the %f was in the code for the Turkey project but no mention of it on that page and why its being used. just thought i would bring that to light.
Thanks for the example, after adding %f to the code it ran the code as expected.
Mike
iOS Mikey, same here, echoing your concern.
First time I ran it, got some message about there being two many functions for the %f to work properly. Unfortunately, I fixed the syntax before copying the error message, so I can’t tell exactly what I did to get that prompt. But pretty sure the %f was the culprit.