How multiplication operations
take place in COBOL?
Multiply var-1 by var-2. Or
If you want to store the
result in specific variable then use GIVING
clause.
Multiply var-1 by var-2
giving var-3.
This will not overrides
var-2 values.
Output:
If we want to multiply
same variable by two or more variables
then use below Program:
Syntax:
MULTIPLY A by B C
Output:
Below will not work
How division operation
take place in COBOL?
Syntax:
DIVIDE var-1 INTO var-2 var-3
var-4
If var-1 = 56 and var-2 =
04 then it means perform the operation 56/2 and stores result in Var-1.
or
If you want to store the
result in specific variable then use GIVING
clause.
DIVIDE var-1 INTO var-2
giving var-3.
Program:
Output:
Now I will change the
value of variable A and submit the job again.
It will gives you only quotient
of operation not remainder.
No comments:
Post a Comment