AP® Computer Science Principles Crash Course by Jacqueline Corricelli
Author:Jacqueline Corricelli
Language: eng
Format: epub
Publisher: Research & Education Association
Published: 2018-09-14T16:00:00+00:00
You cannot have 0 to the right of the MOD.
Example: 20 MOD 0 does not make sense since this would be like dividing by 0.
You can have 0 to the left of the MOD.
Example: 0 MOD 4 is 0 since 0 divided by any number that is not 0 is 0 with a remainder of 0.
Watch for division by 0 errors in MOD calculations — this can get a little confusing. 20 MOD 0 is not valid. 0 MOD 20 is 0. The 0 cannot be to the right of MOD.
iii.Modulus is often used in a program for the following purposes:
To determine if numbers are even or odd.
– If 2 is to the right of MOD, the result of this operation will tell you if the number to the left of MOD is even or odd.
Example 1: 7 MOD 2 is 1. This means 7 is odd.
Example 2: 8 MOD 2 is 0. This means 8 is even.
– General Rule:
If x MOD 2 is 1, x is ODD.
If x MOD 2 is 0, x is EVEN.
To convert between number systems.
– Suppose you want to convert 1600 hours (military time) to our normal AM/PM clock time. 1600 hours is 16:00. The “normal” clock time is a 12–hour system. Applying a modulus of 12 will do the trick!
16 MOD 12 is 4. 16:00 in military time is 4:00.
– If you research MODULUS online, you might see it referred to as “clock time” for this reason.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Art of Coaching Workbook by Elena Aguilar(48065)
Trainspotting by Irvine Welsh(20055)
Twilight of the Idols With the Antichrist and Ecce Homo by Friedrich Nietzsche(17706)
Fangirl by Rainbow Rowell(7834)
Periodization Training for Sports by Tudor Bompa(7328)
Change Your Questions, Change Your Life by Marilee Adams(6641)
This Is How You Lose Her by Junot Diaz(5772)
Grit by Angela Duckworth(4737)
Red Sparrow by Jason Matthews(4666)
Asking the Right Questions: A Guide to Critical Thinking by M. Neil Browne & Stuart M. Keeley(4574)
Paper Towns by Green John(4169)
Room 212 by Kate Stewart(4107)
Ken Follett - World without end by Ken Follett(3972)
The Sports Rules Book by Human Kinetics(3588)
Housekeeping by Marilynne Robinson(3401)
The Motorcycle Diaries by Ernesto Che Guevara(3332)
Introduction to Kinesiology by Shirl J. Hoffman(3301)
Exercise Technique Manual for Resistance Training by National Strength & Conditioning Association(3292)
Double Down (Diary of a Wimpy Kid Book 11) by Jeff Kinney(3272)