PRINT COMMAND WITH MATHEMATICAL OPERATORS:
in LOGO, there are four basic mathematical operations that can be performed:
OPERATION OPERATORS
Addition +
subtraction _
Multiplication *
Division /
let's use each operator and see how it will be used with the PRINT primitive.
Addition (+):
addition command is used when two (or more) numbers need to be added.
syntax: PRINT < nl > + < n2>
where <nl > and <N2> are two numbers that will be added to find their sum.
example: PRINT 2+3 =5
you can have as many numbers to add as you want, as shown in figure 2.
SUBTRACTION ( _ ):
subtraction command is used when difference of two ( or more ) numbers needs to be found. PRINT < nl > - < 2l >
where <nl> and <n2> are two numbers that will be subtracted to find their difference.
example, PRINT 30 _ 20 = 10
you can have as many numbers to subtract as you want, as figure 3 shows.
Multiplication ( * ):
multiplication command is used to multiply two ( or more ) numbers.
syntax: PRINT < NL > * < N2 >
EXAMPLE, PRINT 5 *6 = 30
Division ( / ):
Division command is used to divide the first number by the second.
Syntax: PRINT <NL> / <N2>
where <nl> is the dividend and <n2> is the divisor.
example: PRINT 30/6 = 5
Thursday, 9 April 2015
do you mean by print command with mathematical operators?
Related Articles :
write short notes on the following memory devices? Random Access Memory (RAM) A type of memory on with CPU can perform read and write operations randomly is called Random Access Memory ...
describe briefly importance and function of CPU in the computer?explain the human brain preform?CENTRAL PROCESSING UNIT (CPU): ...
what do understand by data processing? what are the basic elements of compterised data processing? ELEMENTS OF COMPUTER SYSTEM the total system of a computer installation consists of the following elements: 1 &n ...
why hard disk is important in a PC,s? write the two major components of it.HARD DISK: hard disk is the most important s ...
write down the main functions of control unit? explain the arithmetic and logic unit?what is main memory?ARITHMETIC AND LOGIC UNIT: &n ...
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment