Kodewick
Start learning →
Basic←→0 / 70

Parking fee

#014BasicConditions4 min

The car park is free for the first 30 minutes, then 2 per minute. Write ParkingFee(minutes) to return what to pay. Try the Go way: work out the extra minutes extra inside the if, then check it after the semicolon.

Examples
ParkingFee(20)→0
ParkingFee(45)→30
The functionfunc ParkingFee(minutes int) int
main.go
package main

func ParkingFee(minutes int) int {
	// your code here: work out extra in the if; over time? return extra * 2
	return 0
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.