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
Er Ga
Courses Plus Student 1,366 PointsIm not able to pass this challenge task. You should have hints to help you out along the way, like codecademy has.
int addTwo(float a, float b); int main () { float alfa = 7.2; float beta = 8.9; printf("%d", addTwo(alfa, beta)); return 0; }
int addTwo(float a, float b){ return a + b; }
2 Answers
Stone Preston
42,016 Pointsall the challenge wants you to do is implement the method, nothing else. your method is almost correct, except the return type needs to be float, not int (since the arguments are floats and you are returning their sum, the return type will be a float). so change the return type and remove the unnecessary prototype and main method. all you need in the challenge is:
float addTwo(float a, float b){
return a + b;
}
Er Ga
Courses Plus Student 1,366 PointsThanks Stone :)