Math Expressions: familiar operators Flashcards
Enter the operators, in this order, for addition, subtraction, multiplication, and division. Don’t type spaces between them.
+-*/
What is the name of the arithmetic operator that gives you the remainder when one number is divided by another? (one word)
modulus
Type the modulus operator.
%
What is the value of num? var num = 20 % 6;
2
In a single statement, declare the variable largeNum and assign it the result of 1,000 multiplied by 2,000.
var largeNum = 1000 * 2000;
Assign to the variable num the result of dividing 9 by the value represented by the variable qty. The variable num hasn’t been declared beforehand.
var num = 9 / qty;
Assign to a variable the result of adding a number to itself, for example 2 + 2. The variable hasn’t been declared beforehand. Make up the variable name.
var doubledNum = 12 + 12;
Code an alert that displays the result of any mathematical operation on 2 variables. Make up the variable names.
alert(price * qty);
Assign to a variable the remainder when one number is divided by another. The variable hasn’t been declared beforehand. Make up the variable name.
var leftOver = 10 % 3;
Assign to a variable the remainder when the value represented by a variable is divided by a number. The first variable has been declared beforehand. Make up the variable names.
leftOver = num % 3;