sign in
 
   
 
 
 
   
  COBOL TUTORIAL FOR BCA STUDENTS OF M G UNIVERSITY  
  UNIT 4: PROCEDURE DIVISION . . .  
   
     
  MULTIPLY VERB  
 

This statement causes one or more multiplicands to be multiplied by a multiplier and to store the products.

The form of the MULTIPLY verb is as follows:

 
 


 
 

Examples:

 
 

MULTIPLY A BY B.

 
 

In this case the value of A and B will be multiplied and the product will be stored in B. The decimal point position will automatically be taken care of. The old value of B will be lost.

 
 

MULTIPLY A BY B GIVING C.

 
 

Here the value of A and B will be multiplied and the product will be stored in C. The old value of C will be lost but B will contain its old value.

 
 

MULTIPLY A BY B C D.

 
 

Here B will be multiplied by A and the result will be stored in B. similarly, C will be multiplied by A and the product will be stored in C and the result of the multiplication of D and A will be stored in D.

 
  MULTIPLY A BY B C GIVING D E.  
 
In this case the product of B and A will be stored in D, whereas the product of C and A will be stored in E.

 
 

In the case of the MULTIPLY statement also, literals cannot be used for identifier-2, identifier-3, etc. However, if the GIVING option is used, numeric literals are also permitted in place of identifier-2, identifier-3, etc.

For example:

MULTIPLY TAX BY .05 GIVING TAX-BASE.