Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJasper Hamilton
501 PointsHelp with float Variables
Hey, I can't figure out what is wrong with this bit of code, can anyone help me?
float radius = 14.5; printf(%f/n", radius);
1 Answer
eirikvaa
18,015 PointsYou are missing a double quote at the start of your format string (after the first parentheses) and your format string is not what your code challenge expects (check the code challenge text at the top for more information).
Jasper Hamilton
501 PointsJasper Hamilton
501 PointsAh ok then. I'l go try that and see if it works.
{EDIT} Tried that, and it told me that was not the correct input to printf. Here's the code that got that:
float radius = 14.5; printf("%f/n", radius");
{EDIT} found another forum with the same problem as me, and that one had the solution so problem solved.
eirikvaa
18,015 Pointseirikvaa
18,015 PointsYes, as I told you, the format string was not correct (your output should be something like "A ball with a 14.5 radius" or whatever. Anyway, glad to hear that you solved it.