Advertisement
Spocoman

Online Education

Oct 11th, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.69 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5.  
  6. func main() {
  7.     var educationForm string
  8.     var studentCount, onlineStudents, onsiteStudents int
  9.  
  10.     for i := 0; i < 3; i++ {
  11.         fmt.Scanln(&educationForm)
  12.         fmt.Scanln(&studentCount)
  13.  
  14.         if educationForm == "online" {
  15.             onlineStudents += studentCount
  16.         } else {
  17.             onsiteStudents += studentCount
  18.         }
  19.     }
  20.        
  21.     if onsiteStudents > 600 {
  22.         onlineStudents += onsiteStudents - 600
  23.         onsiteStudents = 600
  24.     }
  25.  
  26.     fmt.Printf("Online students: %d\nOnsite students: %d\nTotal students: %d\n",
  27.                   onlineStudents, onsiteStudents, onlineStudents + onsiteStudents)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement