Thursday 9 April 2015

do you mean by print command with mathematical operators?

PRINT COMMAND WITH MATHEMATICAL OPERATORS:        in LOGO, there are four basic mathematical operations that can be performed:     OPERATION... thumbnail 1 summary
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

No comments

Post a Comment