Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var educationForm string
- var studentCount, onlineStudents, onsiteStudents int
- for i := 0; i < 3; i++ {
- fmt.Scanln(&educationForm)
- fmt.Scanln(&studentCount)
- if educationForm == "online" {
- onlineStudents += studentCount
- } else {
- onsiteStudents += studentCount
- }
- }
- if onsiteStudents > 600 {
- onlineStudents += onsiteStudents - 600
- onsiteStudents = 600
- }
- fmt.Printf("Online students: %d\nOnsite students: %d\nTotal students: %d\n",
- onlineStudents, onsiteStudents, onlineStudents + onsiteStudents)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement