RITA v2.0
Time Limit: 0.5 sec
The Problem
RITA can add and multiply numbers successfully with your program. Now Riyad wants it to Divide and subtract numbers. There will be two types of command:
1. SUB N1 from N2: this command will subtract N1 from N2.
2. DIV N1 by N2: this command will divide N1 by N2.
Help him to write the program.
The Input
There will be two types of input:
SUB N1 from N2
DIV N1 by N2
Here N1 and N2 are 64 bit integers. Input will terminate by EOF.
The Output
For each line of input print a line of output. If SUB command is found, just print the answer of (N2-N1).
If DIV command is found,
1. If N1/N2 is undefined then Print “Error!” without quote.
2. If N1 and N2 both are 0 then print “Error!!!”.
3. If N1 can be divided by N2, then print the answer with 2 values after decimal point.
Sample Input
SUB 20 from 10
DIV 20 by 0
SUB 10 from 20
DIV 0 by 0
DIV 20 by 10
DIV 5 by 2
Sample Output
-10
Error!
10
Error!!!
2.00
2.50
Online Practice Contest 3 [School & College Level]
Problem Setter: Fahim Abrar