Print each line of a file with a sequence number

Requirement

  1. Input a file name.
  2. Open the file and print each line, with a leading sequence number.

The program may run as below.

Please input a file name - hello.txt
1 1234567890123
2 Hello, world.
3 Hello
4 World


If you got a blank line between the output as below,
remember to strip off the newline character at the end of the line
(P.155).

1 1234567890123

2 Hello, world.

3 Hello

4 World