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 :
what is ip address? explain by the displaying icon local area network. DISPLAYING ICON LOCAL AREA NETWORK: ...
describe briefly importance and function of CPU in the computer?explain the human brain preform?CENTRAL PROCESSING UNIT (CPU): ...
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 ...
what are the basic components of a computer system?illustrate your answer with simplified diagram. COMPUTER SYSTEM a computer system con ...
what is software? describe the main categories / types of software. SOFTWARE a set of instruction given to the computer to solve a particular problem ( or to perform a specific task), is called softwar ...
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment