Go Console Read user input

Description

Go Console Read user input

package main /*w  w w. j  av a 2 s  .  c  om*/

import "fmt" 

func main() { 
    fmt.Print("Enter a number: ") 
    var input float64 
    fmt.Scanf("%f", &input) 

    output  := input * 2 

    fmt.Println(output) 
} 

We use another function from the fmt package to read the user input.




PreviousNext

Related