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

variables

Any help please!? Link : http://teamtreehouse.com/library/variables-2

I started out with this: float radius = 14.5; printf("A ball with a radius of %f inches\n", radius);

And this is what the system keeps saying:

Bummer! Make sure you are passing a string instead of a NSString to printf. Also, make sure you have the correct format options. (%f is used for floats)

3 Answers

I copy pasted your answer and just got 12 points on the go, thats when I haven't started with Objective -C yet. Works fine for me without any error :)

for first float radius = 14.5;

for second
printf("A ball with a radius of %f inches\n", radius);

= +12 points

Thanks Gunjeet!

Glad I could help. See you around!

Your answer looks right to me, although it should be in two separate lines. One you have used the semi-colon you can't have any other statements after it on the same line...

eg:

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

actually I believe you can have as many statement on one line as you want, just as long as your syntax is correct and you end each statement with a semi colon. The compiler doesnt take into account white space and line breaks.

here is the code editor is expecting: float radius=14.5; printf("A ball with a radius of %f inches",radius);

you actually addedd \n in the end of the quotes which the editor is not expecting and thats why a bummer happened. You need to do exactly what the question is asking and nothing less or nothing more and then only it will let you pass.