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 trialPreston Keck
175 PointsProblems with float function challenge
What am I doing wrong? no error is coming up except bummer... works in x code
{ float radius = 14.5; printf("the radius is %f\n", radius = 14.5);
return 0;
}
2 Answers
Stone Preston
42,016 Pointsyou dont need to include the main function at all so remove your opening and closing curly braces at the beginning and end. you also dont need to return anything so remove the return 0 statement. the syntax for your printf statement is not correct. a print f statement looks like this:
printf("this is a variable: %f", myFloat);
the value of myFloat is inserted into the string where the format specifier (%f in this case) is. The string of your print f is also incorrect. the task states that the string outputted needs to be "A ball with a radius of 14.5 inches.". your current string is "the radius is 14.5" which is not the string its asking for
Preston Keck
175 Pointsfloat radius = 14.5; printf("a_ball_with_a_radius_of_%f_inches\n", radius = 14.5);
something like this?