Failed to run the same program with CMD terminal while with GolLand it works fine.

When I am using GoLand to run my program, everything works fine, just like what I expected. But, my program does not work well when I try to manually run it in CMD terminal.

The command line I used to run my program was “go run c.go” where c.go is my source file.

Here is the correct result from GoLand:

Where the green numbers are the inputs from stdin.

Meanwhile with the terminal:

Any help? Thank you!
Full Code in Playground


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.