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!
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
Frank Truglio10,759 Points
printf statement a ball with a radius of... not understanding the input required
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.
Stone Preston42,016 Points
when using printf with format specifiers and variables, the variable shows up in place of the format specifier. If i had a variable named numberOfCows that had the value 3 and wanted to print it out in a string I could use
printf("There were %d cows on the moon", numberOfCows);
it would output: "There were 3 cows on the moon". See how the value of the variable shows up in the string where the format specifier was? You can apply the same principles above to this challenge, except instead of using %d (ints) you would use %f (for floats)
Marwi M1,411 Points
first : deside the type of data to be displayed. in your case "14.5" , which is float type. we represent float in the printf string by %f. second: printf("the variable value is %f",var);// the text will be printed and instead of %f it will print the value of var
hope that helps you ,