Rounding Numbers and Retrieving Remainders

The next set of numbers code blocks, shown in Figure 8.7, provides the ability to retrieve the remainder portion of any division operation and lets you round any decimal number to the nearest whole number.

Figure 8.7. These code blocks retrieve remainders and round numbers.


The first code block shown in Figure 8.7 returns the remainder portion of a division operation, also referred to as a modulus, as demonstrated in the following example, which divides 10 by 3 and then assigns the modulus (a value of 1) to a variable named Remainder.

The second code block shown in Figure 8.7 returns the rounded value for a specified numeric value, rounded to the nearest whole number, as demonstrated in the following examples, which return values of 4 and 5, respectively.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.150.123