trovato quirk Scan con 0 davanti

parent f2d61d00
...@@ -7,12 +7,19 @@ import "fmt" ...@@ -7,12 +7,19 @@ import "fmt"
func main() { func main() {
var num1 int var num1 int
fmt.Print("inserisci un numero: ") fmt.Print("inserisci un numero: ")
fmt.Scanf("%d\n", &num1) //fmt.Scanf("%d\n", &num1)
//fmt.Scan(&num1) fmt.Scan(&num1)
fmt.Println(num1);
/*
if (num1 % 2) == 0 { if (num1 % 2) == 0 {
fmt.Println("pari") fmt.Println("pari")
} else { } else {
fmt.Println("dispari") fmt.Println("dispari")
} }
*/
//fmt.Printf("%c\n", num1) //Output //fmt.Printf("%c\n", num1) //Output
} }
// problema del "leading zero" https://scripter.co/golang-quirk-number-strings-starting-with-0-are-octals/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment