Postagens

Mostrando postagens com o rótulo If Else

Course C Initial 10th – Exercises with If-Else

Imagem
Lesson 10. As we see in the previous lesson, now we’ll make some algorithms to practice. Those are 10 questions. I recommend that you make this algorithms because it’ll help you in the future. 1- Make an algorithm that reserves how tall is a person and test this conditions: If the Tall is greater than 1.90, printf (“You can play basketball”); If the Tall is smaller than 1.50, printf (“You’re not taller”); if the Tall is greater or equal to 1.50 and smaller or equal than 1.90, printf (“You’re between arrive”); 2- Make an algorithm that works as a game, it may ask to user “What’s the Spanish Capital?” so the user will have available 4 possibility, they’re respectively a) Madrid, b) Barcelona, c) Vigo, d) Sevilla, after will be tested them. Note: use for store the result, a character type variable. If the variable is equal to ‘a’, so printf (“You’re Wright”); Else, so printf (“You’re wrong”); 3- Make an algorithm that works as a table,...

Course C Initial 9th – If-else Selection Command.

Imagem
Lesson 9. Note: for this lesson or the next, you need of all saw up to here. With all that we saw up to here, we can go on to an important thing when we’re programming. How can I use conditions in my code? Well, maybe I don’t run the code fully, so, what can I make? To answer those questions is that I present to you the study about Selections Commands in C language. There’s two selections commands in C, if-else and switch, we’ll see both. But now, we’ll see if-else. First understand the structure: if (condition is true) { #commands } Can you understand? The if command verified if the condition is true, if it’s, so run, else run other command if it there. Analyze the condition below: Else is for the moment that if is false. In some case, problems can be solved with else, it cans economize data. Make an algorithm that test 3 numbers typed by user and print the greater. For the test, will be used logical comman...