🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang
Article #4

Re: I can't figure out how to write this program

#4
From: Leo Divinagracia III
Date: Wed, 22 Nov 1995 00:00
26 lines
2206 bytes
Robert Andrews (robandrews@easynet.co.uk) wrote:
: Please give help to a Pascal beginner.

: I'm using TPW 1.5  and I need to write a program that checks whether a
: given number is exactly divisible by three or not.
: I will need to input a number and get a report back on if it is or
: isn't.
: I can't figure out how I am going to get the program to test this.

: A program will not be essential from you, but I would like to know the
: algorithm for the calculation. E-mail would be preferred.

hmmm...  just MOD the number by 3.  if the result is 0, then it's
divisible by 3, i.e. no remainders.   if you are not familiar with the
MOD function, it does the same thing as the division function, except
MOD returns the modulus or the remainder (another fancy term...).

in case your compiler doesn't have a MOD function, it's time to get a
new one... 8-))  but seriously, the long way to do this is to subtract
the INT (y/x) from just (y/x).  if the result = 0 then the number is
divisble by 3, exactly...
--
later days...

leo d.
ldivinag@s1.csuhayward.edu forward to ldivinag@barney.sbe.csuhayward.edu
Technical Details
Message-ID: <48ud3a$7al@nic-nac.CSU.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <48t8ub$hld@lemon.easynet.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10261c,bb2b906775402ad5
X-Google-Attributes: gid10261c,public
X-Google-Thread: 15878d,bb2b906775402ad5
X-Google-Attributes: gid15878d,public
X-Google-Thread: 1153ea,bb2b906775402ad5
X-Google-Attributes: gid1153ea,public
X-Google-Thread: 111659,bb2b906775402ad5
X-Google-Attributes: gid111659,public
X-Google-Thread: 102601,bb2b906775402ad5
X-Google-Attributes: gid102601,public
X-Google-Thread: f461d,bb2b906775402ad5
X-Google-Attributes: gidf461d,public
X-Google-Thread: 10263e,bb2b906775402ad5
X-Google-Attributes: gid10263e,public
From: ldivinag@s1.csuhayward.edu (Leo Divinagracia III)
Subject: Re: I can't figure out how to write this program
Date: 1995/11/22
Message-ID: <48ud3a$7al@nic-nac.CSU.net>
X-Deja-AN: 119930810
references: <48t8ub$hld@lemon.easynet.co.uk>
organization: Byte Me! Software, Inc.
newsgroups: comp.lang,pascal,comp.lang.pascal.borland,comp.lang.pascal.misc,ctdl.lang.pascal,maus.lang.tpascal,relcom.comp.lang.pascal,relacom.comp.lang.pascal.misc,slac.lang.pascal