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 trialSteve Tucknott
126 Pointsprogram error?
i am using a %f format option....
6 Answers
Stone Preston
42,016 Pointsthe general form of a printf is
printf("some string to print %x", someVariable);
where %x is a format specifier such as %f or %d.
your code is almost correct. your printf statement is not exactly right. you are missing the quotes around your string, the word inches, as well as the variable at the end. your escape sequence also needs to be \n
float radius = 14.5;
printf("A ball with a radius of %f inches. \n", radius);
you must pay close attention to the challenge instructions, if you dont follow everything exactly as they say to, you wont pass
Stone Preston
42,016 Pointscan you post the full code you are trying to use
Steve Tucknott
126 PointsI'm trying to post the screenshot....cant figure out where to add it
Stone Preston
42,016 Pointsyou can just copy and paste the code if you want, its a bit easier to do. to post an image you must upload it to an image host like imgur, then copy the url into a markdown tag like so:
![some image alt text](https://imgur.com/pathtoimage "some title")
the image alt text and the title at the end can be whatever you want.
Steve Tucknott
126 Pointsgunthersnaps.com/screenshot/01.png
Steve Tucknott
126 Pointsthank you, i was completely confused with the error code it was returning me. i thought it was telling me to change the "%f" to "%f"
i failed to examine the code itself as i was trying to fix the %f part....if that makes any sense. thank you thank you!
Stone Preston
42,016 Pointssometimes the errors the challenge gives you dont make much sense. sometimes it cant determine what you did wrong, so the error it provides isnt very helpful
Steve Tucknott
126 Pointswell now that i know that, i think it will be easier to understand this websites advise :)