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 trialCarlos Yepes
50 PointsNumber two is telling me i have the right string but wrong format?
Challenge two is telling me i have the right strong but wrong format. i am not quite sure how the format should be
3 Answers
Stone Preston
42,016 Pointsok the challenge wants to you print that string using the value of your float radius variable, not a static 14.5 like you have right now. Remember that you can use print f to print the value of variables like so:
printf("The road was %d miles long", roadLength);
and the value of my roadLength variable will be inserted into the string where the format specifier is. so if the value of that variable was 10 the statement would output "The road was 10 miles long". The same principle can be applied to your challenge. except instead of using %d (which is for printing ints) you need to use %f (for printing floats)
Stone Preston
42,016 Pointscan you post your code? the format specifier for floats is %f so thats what you should be using
Carlos Yepes
50 Pointsprintf("A ball with a radius of 14.5 inches\n");