J Joseph VIP Member VIP Trusted Contest Holder ★ 20 ★ Impact 37 May 29, 2007 1K views 2 replies #1 Hey, I have a test tomorrow on pascal and can't quite grasp the MOD function in pascal. -100 MOD 8 = -4 I thought it was the remainder? -100/8 = 12.5 answer = 5? Can someone clarify?
Hey, I have a test tomorrow on pascal and can't quite grasp the MOD function in pascal. -100 MOD 8 = -4 I thought it was the remainder? -100/8 = 12.5 answer = 5? Can someone clarify?
Eric VIP Member VIP ★ 20 ★ Impact 328 May 30, 2007 #2 Maybe this would help? http://www.merlyn.demon.co.uk/pas-math.htm#DivMod
S samuofm Established Member ★ 15 ★ Impact 1 May 30, 2007 #3 that link is kinda crptic. MOD ( % ) is just remainder when you do long division. so 13 % 10 is 3 (because 13 divided by 10 is 1 remainder 3) and 5 % 2 is 1 (because 5 divided by 2 is 2 remainder 1) MOD has lots of uses, for example it can test to see if a number is even or odd if ( variable % 2 == 0) number is even i took pascal in junior high, i cant believe they still teach it. Good luck mate. (in your example, remember there are no decimals in long division)
that link is kinda crptic. MOD ( % ) is just remainder when you do long division. so 13 % 10 is 3 (because 13 divided by 10 is 1 remainder 3) and 5 % 2 is 1 (because 5 divided by 2 is 2 remainder 1) MOD has lots of uses, for example it can test to see if a number is even or odd if ( variable % 2 == 0) number is even i took pascal in junior high, i cant believe they still teach it. Good luck mate. (in your example, remember there are no decimals in long division)