Arithmetic Operators

3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$39.99
List Price:  $79.99
You save:  $40
€34.34
List Price:  €68.70
You save:  €34.35
£29.75
List Price:  £59.51
You save:  £29.76
CA$55.26
List Price:  CA$110.54
You save:  CA$55.28
A$61.34
List Price:  A$122.71
You save:  A$61.36
S$51.56
List Price:  S$103.13
You save:  S$51.57
HK$311.87
List Price:  HK$623.83
You save:  HK$311.95
CHF 32.19
List Price:  CHF 64.39
You save:  CHF 32.20
NOK kr403.80
List Price:  NOK kr807.72
You save:  NOK kr403.91
DKK kr256.36
List Price:  DKK kr512.80
You save:  DKK kr256.43
NZ$68.25
List Price:  NZ$136.51
You save:  NZ$68.26
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,863.12
List Price:  ৳9,727.46
You save:  ৳4,864.33
₹3,524.96
List Price:  ₹7,050.81
You save:  ₹3,525.84
RM169.05
List Price:  RM338.15
You save:  RM169.10
₦61,064.73
List Price:  ₦122,144.73
You save:  ₦61,080
₨11,267.18
List Price:  ₨22,537.18
You save:  ₨11,270
฿1,293.08
List Price:  ฿2,586.50
You save:  ฿1,293.41
₺1,646.44
List Price:  ₺3,293.30
You save:  ₺1,646.85
B$218.38
List Price:  B$436.81
You save:  B$218.43
R711.68
List Price:  R1,423.54
You save:  R711.85
Лв67.10
List Price:  Лв134.21
You save:  Лв67.11
₩55,741.82
List Price:  ₩111,497.59
You save:  ₩55,755.76
₪134.54
List Price:  ₪269.12
You save:  ₪134.57
₱2,284.41
List Price:  ₱4,569.39
You save:  ₱2,284.98
¥5,931.38
List Price:  ¥11,864.24
You save:  ¥5,932.86
MX$750.38
List Price:  MX$1,500.95
You save:  MX$750.57
QR145.58
List Price:  QR291.21
You save:  QR145.62
P536.90
List Price:  P1,073.94
You save:  P537.04
KSh5,166.70
List Price:  KSh10,334.70
You save:  KSh5,168
E£1,941.39
List Price:  E£3,883.26
You save:  E£1,941.87
ብር5,716.16
List Price:  ብር11,433.76
You save:  ብር5,717.59
Kz36,469.08
List Price:  Kz72,947.28
You save:  Kz36,478.20
CLP$38,726.71
List Price:  CLP$77,463.11
You save:  CLP$38,736.40
CN¥285.16
List Price:  CN¥570.39
You save:  CN¥285.23
RD$2,518.39
List Price:  RD$5,037.41
You save:  RD$2,519.02
DA5,195.45
List Price:  DA10,392.21
You save:  DA5,196.75
FJ$90.43
List Price:  FJ$180.89
You save:  FJ$90.46
Q306.32
List Price:  Q612.73
You save:  Q306.40
GY$8,355.08
List Price:  GY$16,712.25
You save:  GY$8,357.17
ISK kr4,932.76
List Price:  ISK kr9,866.76
You save:  ISK kr4,934
DH363.26
List Price:  DH726.63
You save:  DH363.36
L668.13
List Price:  L1,336.43
You save:  L668.29
ден2,110.62
List Price:  ден4,221.77
You save:  ден2,111.14
MOP$320.92
List Price:  MOP$641.92
You save:  MOP$321
N$704.48
List Price:  N$1,409.15
You save:  N$704.66
C$1,469.67
List Price:  C$2,939.71
You save:  C$1,470.03
रु5,632.07
List Price:  रु11,265.56
You save:  रु5,633.48
S/141.26
List Price:  S/282.56
You save:  S/141.30
K166.62
List Price:  K333.28
You save:  K166.66
SAR150.04
List Price:  SAR300.13
You save:  SAR150.08
ZK949.74
List Price:  ZK1,899.73
You save:  ZK949.98
L174.39
List Price:  L348.82
You save:  L174.43
Kč839.73
List Price:  Kč1,679.67
You save:  Kč839.94
Ft13,526.45
List Price:  Ft27,056.29
You save:  Ft13,529.83
SEK kr378.31
List Price:  SEK kr756.72
You save:  SEK kr378.41
ARS$54,428.90
List Price:  ARS$108,871.42
You save:  ARS$54,442.52
Bs275.96
List Price:  Bs551.99
You save:  Bs276.03
COP$160,141.69
List Price:  COP$320,323.44
You save:  COP$160,181.74
₡20,189.65
List Price:  ₡40,384.34
You save:  ₡20,194.69
L1,046.93
List Price:  L2,094.13
You save:  L1,047.20
₲288,443.91
List Price:  ₲576,959.95
You save:  ₲288,516.04
$U1,602.41
List Price:  $U3,205.22
You save:  $U1,602.81
zł146.11
List Price:  zł292.25
You save:  zł146.14
Already have an account? Log In

Transcript

Now let's talk about the arithmetic operators. There are many arithmetic operators that we might need to use, and I'm going to discuss the most important ones in this tutorial. The first one that I'm going to talk about is the addition. The addition is adding two numbers, two variables together. So to add the first variable to the other variable, is you just use console and then log and then I'm going to add a plus b. And the result will be added will be printed out on the screen as you can see, 10 plus three, the result is 13.

The next arithmetic operator that I need to talk about is subtraction. subtraction is subtracting the first element, the first variable from the next one. So if I subtract 10 from If I subtract three from 10, the result is seven. The third operator is multiplication. And remember the function that we talked about in previous tutorials which is multiply by two, we use the star sign, which is the multiplication sign. And if we save and run, we have 30.

Because 10 multiplied by three, the result is 30. The fourth arithmetic operator is division, which means that we divide the first element by the the second one. So if I divide a by b, the result is 10 divided by three, the result is 3.333. The last arithmetic operator that I'm going to talk about is very minor. The reminder is the result after we make our division and if there is a reminder, we pray. On the screen.

So for example, if I use the reminder simple which, which is the percentage symbol, and if I divide them by three, the result is three, but the remainder is one. As you can see, the result is one. And I'm sure that you have studied that in high school or in college or even in elementary school. And a very important concept that I need to discuss here is increasing a number by one or decreasing a number by one because it is very important in any programming language. And in JavaScript in specific, which is adding increasing the number for example, if we want to increase the variable a by one, what I would do is just type A and then double plus sign, and then semicolon and then I print the variable a, if I print the variable a, the result is 11. Because double plus sign means that the value has been increased by one.

Now if I want to do the reverse if I want to decrease the number by one, what I would do is I use double subtraction signs and I print the a and if I print the A as you can see it was decreased by one. So these are very important arithmetic operators that you will use a lot in your programs, especially increasing and decreasing by one when you deal with loops, which we will get to it later.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.