Advertisement
Spocoman

05. Average Number

Sep 23rd, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.32 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var numberCount, number int
  7.     fmt.Scanln(&numberCount)
  8.    
  9.     var sumNumbers = 0
  10.  
  11.     for i := 0; i < numberCount; i++ {
  12.         fmt.Scanln(&number)
  13.         sumNumbers += number
  14.     }
  15.  
  16.     fmt.Printf("%.2f\n", float64(sumNumbers) / float64(numberCount))
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement