Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var passengers, stations, outputPassengers, inputPassengers int
- fmt.Scanln(&passengers)
- fmt.Scanln(&stations)
- for i := 1; i <= stations; i++ {
- fmt.Scanln(&outputPassengers)
- fmt.Scanln(&inputPassengers)
- passengers += inputPassengers - outputPassengers
- if i % 2 == 1 {
- passengers += 2
- } else {
- passengers -= 2
- }
- }
- fmt.Printf("The final number of passengers is : %d", passengers)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement