on 01-08-2020 12:59 PM
hello to everyone
could someone help me to correct this code. it seams not to be correct.
Parameter: operand1 TYPE i, operand2 TYPE i, operator TYPE c LENGTH 1.
DATA: result1 TYPE i, ....., ergebnis5 TYPE i.
ergebnis1 = operand1 + operand2. ...., result5 = operand1 % operand2.
CASE operator.
WHEN '+'.
WRITE: / operand1, operator, operand2, 'Is Equal to', result1.
WHEN '-'.
WRITE: / operand1, operator, operand2, 'Is Equal to', result2.
WHEN '*'.
WRITE: / operand1, operator, operand2, 'Is Equal to', result3.
WHEN '/'.
WRITE: / operand1, operator, operand2, 'Is Equal to', result4.
WHEN '%'.
WRITE: / operand1, operator, operand2, 'Is Equal to', result5.
WHEN OTHERS.
WRITE: / 'Give a Operator!!!'.
ENDCASE.
Please what is wrong in this code.
it some other way to write the code.
the calculation of the result must be done each time after the when statement and before the write statement. there is no need to define more than one result.
the first when would be:
when '+'. result = operand1 + operand2.
write: / operand1, operator, operand2, 'equal to', result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
8 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.