Results 1 to 1 of 1
Someone please help me in solvijng this :
you must parse an input line such as
9 / -3 =
or
7.3 % 2 =
and you should compute the ...
- 03-24-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 1
Perl : Line calculator
Someone please help me in solvijng this :
you must parse an input line such as
9 / -3 =
or
7.3 % 2 =
and you should compute the answer (-3 or 1.3).
The syntax for the input is "num1 [op] num2 =" where [num] is
either an integer or a double. [op] is one of: + - / * %.
The / output is an integer or double depending on the arguments (as in java).
The output of % will always be positive.
Your program should output two lines. The first will say:
"op = / ; arg1 = 9; arg2 = -3" OR "invalid input"
and the second line should just return the number
-3


Reply With Quote