+ 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

19th Aug 2021, 5:31 AM
Saneej Palakkal
Saneej Palakkal - avatar
6 Answers
+ 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) }
10th Nov 2021, 5:35 AM
Senior Vova
Senior Vova - avatar
+ 2
Your code doesn't have an error. But sololearn code playground isn't working properly. Please try again later
19th Aug 2021, 8:17 AM
Simba
Simba - avatar
+ 1
thank you for the information
19th Aug 2021, 8:32 AM
Saneej Palakkal
Saneej Palakkal - avatar
+ 1
I checked now.It is working.I didn't even changed the code
19th Aug 2021, 8:35 AM
Saneej Palakkal
Saneej Palakkal - avatar
+ 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) }
25th Mar 2022, 11:46 AM
Mahdi Bahadori
Mahdi Bahadori - avatar
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
18th Sep 2022, 4:40 AM
Kanisak Shakya
Kanisak Shakya - avatar