From here on things start to get real fun.

I know some people don’t like math because they aren’t “Good” at it, or it’s “Hard”. However math is a skill and much like any other skill (including programming) it just takes a little practice to get better!

Now on to the focus of this post.

The arithmetic operators are the same in most languages. Below you can see the basic operators and some examples.

Addition+Used to add numbers2 + 7 = 9
SubtractionSubtract numbers from each other7 – 5 = 2
Multiplication *Used to multiply numbers together 2 * 5 = 10
Division/Divide numbers by other numbers10 / 2 = 5
Modulo%Much like division with the key difference being that modulo only shows you the remainder.5 % 3 = 2
Basic operators

Now we will use these operators with examples using “Pseudo Code“.

// we will use varX which is 10
// And varY which is 2 for the examples.

number varX = 10
number varY = 2

varX + varY
//result is 12

varX - varY
//result is 8

varX * varY
//result is 20

varX / varY
//result is 5

varX % varY 
//result is 0
//2 goes into 10, 5 times with no remainder.

That is the basics of operators.

Congratulations! You have leveled up in programming!

Next – Demystifying Programming – 4 Conditionals

Previous – Demystifying Programming – 2 Variables

Leave a Reply

Your email address will not be published. Required fields are marked *