Advertisement
Spocoman

05. Sum Numbers

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