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 trialDenizcan Durgun
Courses Plus Student 268 PointsWhere is my fault?
float radius = 14.5; printf(" A ball with a radius of 14.5 inches.float radius = 14.5");
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsYour first statement looks good.
The printf statement is the problem. It looks like you're trying to re-create the radius variable again which you don't need to do.
They specify the output should be A ball with a radius of 14.5 inches.
The first argument to printf is a format string. This describes what the output is going to look like.
We can use the following format string "A ball with a radius of %f inches." The %f is a format specifier which indicates that a float value is going to be inserted there.
printf can then take additional arguments whose values will be inserted where the specifiers are.
Here's the full printf statement:
printf("A ball with a radius of %f inches.", radius);
Notice the comma and then the second argument passed in is the variable which contains the value that we would like to be inserted where the %f is.
You may want to review the video too.