Advertisement
Spocoman

03. Sum Numbers

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