Math operators-II. Lesson 5


#1

I can't understand the result of this exercise:
365%27. There is no any math operator (add+, subtract-, multiply* or divide/). What math operator is needed here? Explain me, please. I don't want to right down the answer using the answer (it's 14.) I want to understand how we get this answer.
E.g.365%27=?
Where 365 is a
27 is b
? is the answer

That's clear with the two tasks from this lesson. But what about the third lesson? I have no progress in any way here.
Let's see.
The division operator is the sign /.
The modulus is the sign %.
In the first task we have 365/27 = 13.518.

And in the last third task it's need to know how many days into the moon's phase it will be in exactly one year.
Could you help me, please?

https://www.codecademy.com/courses/learn-javascript/lessons/introduction-to-javascript/exercises/math-operators-ii?action=lesson_resume



#2

What's the issue? :smiley:


#3

Good evening, Orion. You mean what my problem is, don't you?


#4

I see you edited it...

In this program, you need to print out two things, one with the division operator, and one with the modulus.

Your math is right, just make sure you do one with 365/7, and one with 365%7. They generate different results.


#5

Orion, I can't understand what the math operator is needed in the other one 365%27. What must I do with these two numerals: to add, subtract, multiple or divide?


#6

The modulus operator (%) returns the remainder of a division instead of how many times it can be divided like a normal division (/)


#7

I don't understand at all.
Let's see the difference between modulus operator and percent. Is it the same things?
I'm ashamed of my English level.It's poor. I'm sorry.


#8

Well, in the real world the % sign means percentage. But in programming, outside of CSS, it almost never means percentage and is used as a modulus operator.

Example: 12 % 5 = 2
It will divide the first number by the second number (like normal division) and then return the remainder, or the left-over that could not have been evenly divided


#9

Notosmirk, I think I begin to understand. Just a moment, please.


#10

I'm glad I could help you out Ismira5757 :smiley: Keep in mind that remainders aren't turned into decimals after an uneven division problem has taken place. The % operator can be used to see if a number is able to be divided evenly before passing it into an equation. Among other uses, it is very helpful to check user input variables to see if they are okay to get put in a function/method/equation. Hope this helps


#11

Oh, yes. I did it with the help of you, dear Notosmirk. It's so easy.
Thank you, Notosmirk. And thank you, Orion.


#12

Glad I could help friend :blush: Keep on learning and never be afraid to ask questions!


#16

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.