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 trial

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

faeroah springs
faeroah springs
89 Points

trouble with variable challenge

I can't figure out this question, I've tried a few different ways and none have worked. "Add a printf statement to print the radius variable. Here is what your output should look like: A ball with a radius of 14.5 inches." Will someone please show me a correct answer to this or something similar? I did this: float radius = 14.5;

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

return 0;

I'm gonna keep trying of course but a little assistants will be appreciated.

Turd Furgeson
Turd Furgeson
2,579 Points

I'm not at this point in the course yet, but the first thing that sticks out is no comma after the "" print statement. Maybe try printf(%f A ball with a radius of 14.5 inches.\n", radius);

Like I said, not there yet, so take it with a grain of salt.

Turd Furgeson
Turd Furgeson
2,579 Points

Just read the challenge.

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

maybe? I'm trying to work it out with you. lol

faeroah springs
faeroah springs
89 Points

this last suggestion is what i tried after posting this question and it didn't work either. I'm going to try it again when i get time to work on it again. Thank you for helping so far. Now that you're on this part let me know if you figure it out and i'll do the same.

Turd Furgeson
Turd Furgeson
2,579 Points

Just tried

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

Worked for me.

4 Answers

William Baker
William Baker
2,485 Points

try printf("a ball with a radius of %f.\n", radius);

Note the %f instead of stating the answer.

Hope this works/helps!

faeroah springs
faeroah springs
89 Points

it makes sense and i tried it after i posted but it still didn't work. Your reply does help and now I understand the %f would plug in the 14.5 from the float line.

William Baker
William Baker
2,485 Points

try printf("a ball with a radius of %f.\n", radius);

Note the %f instead of stating the answer.

Hope this works/helps!

William Baker
William Baker
2,485 Points

try printf("a ball with a radius of %f.\n", radius);

Note the %f instead of stating the answer.

Hope this works/helps!

William Baker
William Baker
2,485 Points

try printf("a ball with a radius of %f.\n", radius);

Note the %f instead of stating the answer.

Hope this works/helps!