+ 1
Age on mars project error
can you please help me to solve this project. this is my attempt. package main import "fmt" func mars_age(x int) int { return (x * 365) / 687 } func main() { var age int fmt.Scanln(&age) mars := mars_age(age) fmt.Println(mars) } it is not showing any output
6 Respuestas
+ 6
package main
import "fmt"
func mars_age(ages int) int {
var ab float64
ab = float64(365)/float64(687)
var abInt float64 = ab * float64(ages)
return int(abInt)
}
func main() {
var age int
fmt.Scanln(&age)
mars := mars_age(age)
fmt.Println(mars)
}
+ 2
Your code doesn't have an error.
But sololearn code playground isn't working properly.
Please try again later
+ 1
thank you for the information
+ 1
I checked now.It is working.I didn't even changed the code
+ 1
This will work great
package main
import "fmt"
var age int
func mars_age(age int)int{
fmt.Scanln(&age)
return (age * 365)/687
}
func main(){
result := mars_age(age)
fmt.Println(result)
}
0
package main
import "fmt"
func mars_age(ages int) int {
var ab float64
ab = float64(365)/float64(687)
var abInt float64 = ab * float64(ages)
return int(abInt)
}
func main() {
var age int
fmt.Scanln(&age)
mars := mars_age(age)
fmt.Println(mars)
}
// done