can I give the 9v input power for arduino mega 2560 using vin pin?
Yes!


  The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
  
  The power pins are as follows:
  - Vin. The input voltage to the board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.  


https://www.arduino.cc/en/Main/ArduinoBoardMega2560

Vin is the same as the external positive power input.