Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Objective-C Basics (Retired) Fundamentals of C Variables

Zachary Roark
Zachary Roark
66 Points

%f = Float Radius 14.5??? Or does it?

Hello there,

I am having issues with the challenge part 2 of 2. When it asks to write "A ball with the radius of 14.5 inches" I thought it wants you to write %f, to indicate the 14.5 from the float radius line/challenge before, but when I do that and check the work, it says that it does not work.

Is there something I am missing? I have tried everything else I could think of and nothing has worked so far.

Thank You!

2 Answers

11,940 Points

You probably forgot to include the variable you wanted to use.

printf("A ball with the radius of %f inches.\n", radius);

%f won't do anything if you forget to include the variable outside the string :) Hope that works!

Zachary Roark
Zachary Roark
66 Points

Now it makes sense. I didn't really understand the purpose of the radius variable at the end until you showed me. Thank you!

Hey Zach, here's the answer.

float radius = 14.5;
printf("A ball with a radius of %f inches.", radius);