![]() |
VOOZH | about |
In Go language, fmt package implements formatted I/O with functions analogous to C's printf() and scanf() function. The fmt.Scanf() function in Go language scans the input texts which is given in the standard input, reads from there and stores the successive space-separated values into successive arguments as determined by the format. Moreover, this function is defined under the fmt package. Here, you need to import the "fmt" package in order to use these functions.
Syntax:
func Scanf(format string, a ...interface{}) (n int, err error)
Parameters: This function accepts two parameters which are illustrated below:
Returns: It returns the number of items successfully scanned.
Example 1:
Input:
GFG 3
Output:
The word GFG containing 3 number of alphabets.
Example 2:
Input:
GeeksforGeeks 13 6.789 true
Output:
GeeksforGeeks 13 6.789 true