Lesson 7. Now, as promised in previous lesson, we’ll go to make some algorithms to practice all knowledge that we learned up to here. First: Make an algorithm that reserves 3 numbers by user and sum them, after show the result. For this, we first make the structure as showed below. How we can see, this is the basic structure of a software in C language. Now, we’ll create the variables for it: Okay, the variables was created. Now we’ll input the values for them with printf’s and scanf’s how you can see below: Note: always use return 0; in the end function. Now we’ll create a new variable called Result that will be the sum of Num1, Num2 and Num3 how you can see below. After we’ll print Result. That’s finished, we have an algorithm that calculates the sum between 3 numbers. Now, practice this algorithm, write and test yourself, test it change the math operators and joyful. You cou
Lesson 3 Part. 1. Hello again! As promised in the previous class, now I speak about variables in C language. First, what’s a variable? The answer is important because it will help us to learn more and use them. Definition: capable of being varied or changed; alterable. (source: www.dictionary.com). That’s the definition that we need! So, there’s some variables types in C language. They’re: Global; Locale; Constant; Volatil e; Inside each one of those cases, we have in resume, 4 type that can be represent in each or all those cases. Below, you’ll can see its names. c har – ‘a’, ‘b’, ‘c’,...; int – 1, 2, 4, 7,...; float – 7.553279, 8.856347,...; double – 9.5896324789632, 10.5885569347799,... ; There’s variations inside each format, but we’ll see in the future. How we can see above, the type data that the variables types represent. Char is for character data, int is for integer, float is for floating point
As was promised in the previous lesson, now we’ll see the input command in python language, it’s a smaller lesson, next lesson, we’ll see variable’s concepts in Python that’s different of others languages. First step: - I recommend that you use the output command. In python, input command requires a variable. There’s two ways to use this command, they’re: - with print. - without print. Note: In python, you don’t need to use ‘;’ in the end of a line, it works, but it isn’t required. With print: print(‘type any key...’) a = input() Test it yourself! See it in the editor: Run and see what happen. It required that the use type any thing by the keyboard. Below, see it being ran. But there’s other way to do this code, see below: a = input(‘Press any key...’) Test it yourself! Think about it, that’s the way to learn! The appearance is:
Comentários
Postar um comentário