Variable remainder

Variable remainder
0

#1

my answer. var Remainder = 2 % 11;
and I get the error message; ReferenceError: ‘remainder’ is undefined, the question is; 11 / 3 what is the % ( Remainder)


#2

Can you post all of your code? What you posted is not enough for me to give you an answer to your question.

I am hoping the following will help explain the difference between the / and % operators. The % is the remainder operator. The / is the division operator.

var divOperator = 11 / 3; 
console.log(divOperator); // displays 3.6666666666666665
var remOperator = 11 % 3;
console.log(remOperator); // displays 2 because 11 divided by 3 is 3 with a remainder of 2

#3

Hi this is the question;
The remainder operator % gives the remainder of the division of two numbers.

Example;

5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)

Usage
In mathematics, a number can be checked even or odd by checking the remainder of the division of the number by 2.
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)

Note
The remainder operator is sometimes incorrectly referred to as the “modulus” operator. It is very similar to modulus, but does not work properly with negative numbers.

Instructions

Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.


#4

OK, so the code starts with:

var remainder;

You need to assign the remainder of 11 divided by 3 to the variable shown above called “remainder”. The example in the challenge shows you how to divide 17 by 2 to get the remainder of 1. The example does this using 17 % 2

See if you can now complete the challenge.


#5

My answer was;
var Remainder = 2 % 11;

but I get an error message ReferenceError: ‘remainder’ is undefined. If I try and write anything else it gives other warnings.


#6

Hi Randell,
I understand what the symbols mean, and of course how to use / * + -, I understand what the % stands for ( remainder) of the number after calculation.
I can enter the code adding the value; var Remainder = 2 % 11; which should mean 2 remaining out of 11 after the calculation right.
So why is the var remainder undefined? ReferenceError: ‘remainder’ is undefined
I have assigned a value to it; eg; the number 2 so it is equal to the remainder of 11/3.


#7

JavaScript is case-sensitive, so Remainder is not the same as remainder in terms of variable names. The challenge wants you to use a variable named remainder. You are incorrect on your calculation logic. It is 11 % 3 which will divide 11 by 3 and return a remainder of 2.


#8

this is how I have written the code; var Remainder= 2 % 11;


#9

See my last message.


#10

OK right see it…thankyou for pointing out the not so obvious to me…


#11

I assumed they wanted me to add to the code not change it, many thanks.