To get the full benefit of the lesson, watch the video
Lesson 6: Mathematical Operators
NOTE: for a fast copy, follow these steps in order:
- Click anywhere in a text box below (result will be a blinking vertical line in the text box)
- Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time)
(The result should be that all the text inside the text box lights up in blue)
- Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere
you wish
Example of the mathematical operators |
Here are examples on how to apply the the addition, subtraction and multiplication.
The division operator outputs different results depending on the variable type.
Although 110/40 is 2.75, because these were all integer types, the result will ignore the decimal values and will use 2 as the value.
The float type stores decimal values and can be used to approximate values. (There is a better type to use other than float in the next
lesson)
If you use arithmetic with an int type and a float type, the result will be of the type float.
The mod ("%") operator is used for finding the remainder of a quotient. The mod operator can only be used for int types only.
Here is an example on how to ask a second grader the quotient of two integer values.
Bro...Don't remember on some1 who helped me like you.......simply said....you're the best !!
ReplyDelete