In reply to VIKRANT97:
The compiler is showing the error just before the if(op==1) line. I guess its creating a latch for the outputs just before that loop starts. However, initializing the inputs gives an error and initializing the outputs does not help either. How else can we initialize the variables o avoid the latch? Thanks!