1 00:00:00,600 --> 00:00:04,740 Arithmetic operators are used to perform arithmetic on numbers. 2 00:00:04,740 --> 00:00:07,940 Both constants and variables. 3 00:00:08,010 --> 00:00:14,280 This chart provides a quick overview of the different operators that can be used. 4 00:00:14,290 --> 00:00:19,020 Now let's go over some examples to see how each one works. 5 00:00:19,270 --> 00:00:22,120 We'll begin by adding two numerical values 6 00:00:28,800 --> 00:00:31,670 in between our open and close script tags. 7 00:00:31,840 --> 00:00:40,240 We'll create a variable called X the value of x will be 100 plus 50 8 00:00:46,200 --> 00:00:47,160 next we'll create 9 00:00:50,610 --> 00:00:52,260 our get element by I.D. 10 00:00:57,410 --> 00:01:07,520 and the idea will be the word add that we'll go ahead and create the paragraph that will contain the 11 00:01:07,520 --> 00:01:19,140 output value. 12 00:01:20,250 --> 00:01:29,010 Let's go ahead and save our file and previewed in our web browser and we can see that we get the value 13 00:01:29,010 --> 00:01:37,430 one hundred and fifty which is the correct value. 14 00:01:37,590 --> 00:01:45,960 Now let's go ahead and perform another calculation this time we'll add two values and multiply the result 15 00:01:46,320 --> 00:01:48,270 by the value of another variable 16 00:01:51,260 --> 00:02:01,910 so let's go ahead and define two variables that variable a which will equal three variable B which will 17 00:02:01,910 --> 00:02:09,000 equal 20 plus 30 multiplied by a. 18 00:02:09,020 --> 00:02:12,440 So in this case it'll be multiplied by three 19 00:02:21,020 --> 00:02:31,130 now we'll just create our output and we'll call the I.D. add 2 and we'll display the result underneath 20 00:02:32,120 --> 00:02:33,780 our first calculation. 21 00:02:37,530 --> 00:02:41,800 Then we'll save the file and refresh our web browser 22 00:02:44,610 --> 00:02:49,350 so here we have once again one hundred and fifty output. 23 00:02:50,520 --> 00:03:06,030 So that would be 20 plus 30 which is 50 multiplied by three which equates to one hundred and fifty. 24 00:03:06,140 --> 00:03:08,570 This next example will subtract two values 25 00:03:14,860 --> 00:03:21,150 called a variable C and we'll do one hundred minus 50. 26 00:03:21,530 --> 00:03:29,540 And this time we'll give it the I.D. sub and we'll output the result at the bottom of our other two 27 00:03:29,540 --> 00:03:30,320 calculations 28 00:03:37,530 --> 00:03:39,240 and then we have it. 29 00:03:39,270 --> 00:03:42,210 So that's how we multiply add and subtract.