Mod: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "''result'' = ''x'' MOD ''y'' '''Description''' MOD divides ''x'' by ''y'' and returns the integer part of the remainder. The required parameters, ''x'' and ''y'', are any va..."
 
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
''result'' = ''x'' MOD ''y''
''result'' = ''x'' Mod ''y''


'''Description'''
== Description ==


MOD divides ''x'' by ''y'' and returns the integer part of the remainder. The required parameters, ''x'' and ''y'', are any valid numeric expressions. The value of ''result'' is a whole number with a magnitude less than the magnitude of ''y''.
Mod divides ''x'' by ''y'' and returns the integer part of the remainder. The required parameters, ''x'' and ''y'', are any valid numeric expressions. The value of ''result'' is a whole number with a magnitude less than the magnitude of ''y''.


'''Example'''
== Example ==


<pre>
<pre>
REM MOD Example
Rem Mod Example
'MOD returns quotient remainder as integer
'Mod returns quotient remainder as integer
DIM Answer
Dim Answer
Answer = 15 MOD 2
Answer = 15 Mod 2
PRINT "15 MOD 2 = " & Answer
Print "15 Mod 2 = " & Answer
Answer = 21 MOD 3.7
Answer = 21 Mod 3.7
PRINT "21 MOD 3.7 = " & Answer
Print "21 Mod 3.7 = " & Answer
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
15 MOD 2 = 1
15 Mod 2 = 1
21 MOD 3.7 = 1
21 Mod 3.7 = 1
</pre>
</pre>
[[Category:Language Reference]]

Revision as of 02:16, 17 August 2012

result = x Mod y

Description

Mod divides x by y and returns the integer part of the remainder. The required parameters, x and y, are any valid numeric expressions. The value of result is a whole number with a magnitude less than the magnitude of y.

Example

Rem Mod Example
'Mod returns quotient remainder as integer
Dim Answer
Answer = 15 Mod 2
Print "15 Mod 2 = " & Answer
Answer = 21 Mod 3.7
Print "21 Mod 3.7 = " & Answer

Output

15 Mod 2 = 1
21 Mod 3.7 = 1