题解 | #数字颠倒#
数字颠倒
http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
package main
import (
"fmt"
)
func main() {
var s int
fmt.Scan(&s)
if s == 0 {
fmt.Println(s)
return
}
for s != 0 {
fmt.Print(s % 10)
s /= 10
}
}
数字颠倒
http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
package main
import (
"fmt"
)
func main() {
var s int
fmt.Scan(&s)
if s == 0 {
fmt.Println(s)
return
}
for s != 0 {
fmt.Print(s % 10)
s /= 10
}
}
相关推荐