In this lesson we'll explore a few other arithmetic operators.
We'll begin with division in this example.
We'll divide two values together
we'll start by declaring a variable we'll call the D.
The value of D will be one hundred divided by 50.
Next we'll set up our output we'll call the I.D. Div I
and we'll set up a paragraph in our body tag to display the output and once we save our file we'll go
ahead and preview it in our web browser and we can see that the correct value is output ID.
Next will increment the value of variable.
So we do that for this example will we'll go ahead and declare about a variable called X. And give it
the value of five
next type in x plus plus and a semicolon.
This will increment the value of X by 1 so if X equals 5 the next value up would be 6 will store the
incremented value in a variable called Z
and then we'll go ahead and set up our output.
Now we'll go ahead and save the file
and refresh our web browser and we can see the value 6 output it below our last calculation.
We can also decrement the value of a variable.
So instead of going up this time we'll set up a calculation so our union arithmetic that decreases the
value of the variable.
So instead of going from five to six we'll go from five to four
set up a new variable and we'll call this variable H
next type in H minus minus and the semicolon will store the new value in a variable called K and set
up our output
o save our file and refresh our web browser and we can see that the value of k is output.