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
Manisha Nayyar
94 Pointscode challenge -variables
need help with the variable assignment language C
4 Answers
Marshall Huss
3,504 PointsYou have an error in your printf line. You are closing it with a } instead of a ')'.
Here is the correct syntax:
printf("%f is the radius.\n", the_radius);
Manisha Nayyar
94 Pointsint main()
{
float the_radius=14.5;
printf("%f is the radius.\n",the_radius};
return 0;
}
that is the code i wrote but i am still getting the syntax error .
Manisha Nayyar
94 Pointsoops !I did a silly mistake.Thanks.
Manisha Nayyar
94 Pointsstill getting error with tis task
"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."
this is the error Make sure you have the correct format options. (%f is used for floats)
here is my code
int main()
{
float radius = 14.5;
printf("A ball with a radius of %f inches.\n",radius);
return 0;
}
Marshall Huss
3,504 PointsI see you're adding a \n to the end of the string. printf already inserts a newline so this would print out 2 newlines. Try removing the \n.
Marshall Huss
3,504 PointsMarshall Huss
3,504 PointsCould you be more specific with your question?