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

code challenge -variables

need help with the variable assignment language C

Could you be more specific with your question?

4 Answers

You 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);
int 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 .

oops !I did a silly mistake.Thanks.

still 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;
}

I 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.