Advertisement
Spocoman

06. Max Number

Sep 22nd, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.37 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "math"
  6.     "strconv"
  7. )
  8.  
  9. func main() {
  10.     var input string
  11.     fmt.Scanln(&input)
  12.    
  13.     var maxNum = -math.MaxInt64
  14.  
  15.     for i := 0; input != "Stop"; i++ {
  16.         n,_ := strconv.Atoi(input)
  17.         if n > maxNum {
  18.             maxNum = n
  19.         }
  20.         fmt.Scanln(&input)
  21.     }
  22.        
  23.     fmt.Println(maxNum)
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement