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 trialJessica Jones
216 PointsNot getting it.
I am not getting the challenge correctly and am not given any instruction on how to fix it. I need the answer so I can see what I am doing wrong not "bummer" over and over again with no guidance.
5 Answers
Keegan Gladstone
Courses Plus Student 16,208 Pointsyes almost there. The correct answer is:
float radius = 14.5;
printf("A ball with a radius of %f inches", radius);
Think of the %f symbol and the radius following the comma as a pair. Wherever you place the %f, it will get the value of the radius variable, and place it there.
Keegan Gladstone
Courses Plus Student 16,208 PointsAs another example,
We could say printf("%f %f %f", radius1, radius2, radius3);
the first %f would be paired to radius1, and print that value. the second %f would be paired to radius, and print THAT value. and the last %f would be paired to radius 3 and finally print this value.
I Hope this helps, after the learning curve things start to make a lot more sense!
Keegan Gladstone
Courses Plus Student 16,208 PointsHey Jessica,
Please copy and paste your code challenge into your post so we can see whats up. Also, make sure you place it inside three hash marks.
Jessica Jones
216 Pointstask: Create a float variable named 'radius' with the value '14.5'. (Do not write the main function) my answer: float radius = 14.5; This I got correct.
Next was to write a print f I wrote: print f ("%f a ball has a radius of"); This is not correct.
Jessica Jones
216 PointsThank you