FAQ: Conditionals: Lesson - Review

This community-built FAQ covers the “Review” exercise from the lesson “Conditionals: Lesson”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn C

FAQs on the exercise Review

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Came back now that the full course is released. scanf() is used in the review hint, but was formatting explained anywhere?

I’m thinking the same thing! I could be wrong but i’d swear there is no explanation (or not sufficiently explicit) for the use of scanf() prior to this exercise.

This was a very strange lesson. I don’t remember being introduced to neither the scanf() function nor to the argument “&x”, which the hint suggested. Furthermore it says the lesson is optional, but I couldn’t click “up next” without solving the exercise, which meant I ended up just copying the hint.

Same here, follow carefully each previous lessons, scanf() was not approach.

I encounter the same problem with scanf()
I solved it like this, have no idea if it is right

#include <stdio.h>

int main() {

double earth_weight = 50;
printf(“Earth weight: %f kg\n”, earth_weight);
int numberPlanet = 3;

float mercury1 = earth_weight0.38;
float venus2 = earth_weight
0.91;
float mars3 = earth_weight0.38;
float jupiter4 = earth_weight
2.34;
float saturn5 = earth_weight1.06;
float uranus6 = earth_weight
0.92;
float neptune7 = earth_weight*1.19;

{
if (numberPlanet = 1){
printf(“Mercury: %f\n”, mercury1);
}
else if (numberPlanet = 2){
printf(“Venus: %f\n”, venus2);
}
else if (numberPlanet = 3){
printf(“Mars: %f\n”, mars3);
}
else if (numberPlanet = 4){
printf(“Jupiter: %f\n”, jupiter4);
}
else if (numberPlanet = 5){
printf(“Saturn: %f\n”, saturn5);
}
else if (numberPlanet = 6){
printf(“Uranus: %f\n”, uranus6);
}
else if (numberPlanet = 7) {
printf(“Neptune: %f\n”, neptune7);
}
}

}