Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: How to make the rest entire?

1. ## How to make the rest entire?

Hi all guy!! I have problem begginer!!
In my equazion random ex: 140/26 = 5 rest 10.
How to do make my rest 10 and put in an a Variable? (in Javascript)?
Code:
```function rest ()
{
var a = 140;
var b = 26;
var division = a / b; // 140 / 26 = 5 rest 10 :D

• Code:
```<script type="text/javascript">
var a = 140;
var b = 26;
var division = Math.floor(a/b);
var reminder = a%b;
alert(division+" with a remember of "+reminder);
</script>```

• Originally Posted by sunfighter
Code:
```<script type="text/javascript">
var a = 140;
var b = 26;
var division = Math.floor(a/b);
var reminder = a%b;
alert(division+" with a remember of "+reminder);
</script>```
Ei ! i'm test your code but the rest or remember isn't correct, i write 131 / 26
= 5 and rest 0, the code back me rest remember 1 ...
Can you explain me how to do the 1%b Thanks guy for your time!!

• Originally Posted by triko
Ei ! i'm test your code but the rest or remember isn't correct, i write 131 / 26
= 5 and rest 0, the code back me rest remember 1 ...
Can you explain me how to do the 1%b Thanks guy for your time!!
Well, that is the correct answer!

Code:
```<script type="text/javascript">
var a = 131;
var b = 26;
var division = Math.floor(a/b);
var remainder = a%b;
alert (division+" with a remainder of "+remainder); // 5 with a remainder of 1
</script>```
Your English seems rather fractured. The word is remainder, not reminder or remember.

• Actually, it was Sunfighter who used "remember" and "reminder" instead of "remainder".

Not sure they teach English in Missouri. <grin/>

• hee hee, Guess it was.

• Hey, this is the JavaScript forum, not the English forum. You got the important part right. <grin/>

• Originally Posted by Philip M
Well, that is the correct answer!

Code:
```<script type="text/javascript">
var a = 131;
var b = 26;
var division = Math.floor(a/b);
var remainder = a%b;
alert (division+" with a remainder of "+remainder); // 5 with a remainder of 1
</script>```
Your English seems rather fractured. The word is remainder, not reminder or remember.
No Philip I had copy the word by code of sunfighter!!!!
But, don't understand what is a%b

• Originally Posted by Old Pedant
Hey, this is the JavaScript forum, not the English forum. You got the important part right. <grin/>
Thanks Pedant for clarification But, however the English it's more important for make oneself understood Infact my English , it's a little crap!!! no, more crap

• a % b means *EXACTLY* "calculate the remainder when a is divided by b".

% is properly called the "modulo operator". What you called "rest" and we call "remainder" are both NOT correct mathematical terminology. "Modulo" is the correct terminology and % is indeed the modulo operator.

Incidentally, many languages use % as the modulo operator:
JavaScript
Java
C
C++
C#
PHP
and more.

• Originally Posted by Old Pedant
a % b means *EXACTLY* "calculate the remainder when a is divided by b".

% is properly called the "modulo operator". What you called "rest" and we call "remainder" are both NOT correct mathematical terminology. "Modulo" is the correct terminology and % is indeed the modulo operator.

Incidentally, many languages use % as the modulo operator:
JavaScript
Java
C
C++
C#
PHP
and more.
An ok, so the name correct it's Modulo OK... however I had called "rest" because in Italian remainder is resto!

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•