Help
Author Message
Help

Could anyone out there help me with Turbo Pascal
I need to know how do you Evalute these expressions:
a. 13 mod 5
b. 5 mod 12
c. 12.0 / 5

Wed, 18 Jun 1902 08:00:00 GMT
Help
Quote:

> Could anyone out there help me with Turbo Pascal
> I need to know how do you Evalute these expressions:
> a. 13 mod 5
= 3
> b. 5 mod 12
= 5
> c. 12.0 / 5

= 2.4

no computer required for this  ;-)

now this time your problem seems to distinguish between '/' and 'div' and
'mod':   / devides, giving a foatinpoint-result
div devides integers, disposing the rest and only returnig an int
mod returns the rest of an integer division

hope that helps..

--

Wed, 18 Jun 1902 08:00:00 GMT
Help

JL>Could anyone out there help me with Turbo Pascal
JL>I need to know how do you Evalute these expressions:
JL>a. 13 mod 5
JL>b. 5 mod 12
JL>c. 12.0 / 5

Simple... Mod is what remains of the first number after being divided by
the second number. So:

13 mod 5 = 3
5 mod 12 = 0  (5 can't be divided by 12 and give a round number)

The last one is the same as:

12 div 5

but you're dealing with reals so the answer must be a real as well:

12.0 / 5 = 6.0

-- Kim Forwood --

/-=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=-\

%         For what purpose is life, if one cannot live freely?         \$
\-=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=-/

Wed, 18 Jun 1902 08:00:00 GMT
Help

Quote:

>        12.0 / 5 = 6.0

Wow!  How did you work that one out?  Poor old me got 2.4  :)

Now, 12.0 * .5 ...

.splitbung
--
* TQ 1.0 * The 'Just So Quotes'.
God is real unless declared integer.

Wed, 18 Jun 1902 08:00:00 GMT
Help

Quote:

>Simple... Mod is what remains of the first number after being divided by
>the second number. So:

Correct.

Quote:
>       13 mod 5 = 3
>       5 mod 12 = 0  (5 can't be divided by 12 and give a round number)
>The last one is the same as:
>       12 div 5

Don't think so...last time I remember, 12 goes into 5 zero times with
a remainder of 5....5 mod 12 is 5.  You are contradicting your own
definition.

Quote:
>but you're dealing with reals so the answer must be a real as well:
>       12.0 / 5 = 6.0

Uh?  No.  Last time I checked, 12.0 / 5 is 2.4.

What kind of arithmetic are you using? :>

Glenn Grotzinger

MOD and S3M user extraordinaire.
Writer of TP tutorial.  All released parts findable at:
ftp://garbo.uwasa.fi/pc/turbopas/tptutr10.zip

Wed, 18 Jun 1902 08:00:00 GMT

 Page 1 of 1 [ 5 post ]

Relevant Pages