Learn
Similarly, LOLCODE supports equivalents of the *
and /
operators:
BTW Multiplication PRODUKT OF x AN y BTW Division QUOSHUNT OF x AN y
These follow the same rules as adding or subtracting: if either is already a NUMBAR
, the result is too; otherwise, the result is a NUMBR
.
For dividing, if both numbers are NUMBR
s, any remainder will be truncated, like when converting from a NUMBAR
to a NUMBR
.
Instructions
1.
Print out the result of multiplying 3
and 4
.
2.
Create a variable named capacity
equal to 9
.
3.
Create a variable named roughCapacity
equal to capacity
divided by 2
and print it out. Note how the number is rounded to the nearest integer.
4.
Create a variable named exactCapacity
, and this time use a floating point NUMBAR
to set it to the result of dividing capacity
in two.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.