0
A question on go, your age in mars
Has any of you solved that age on mars thing in go. I have tried so many ways to go about it, but I am still getting stuck
7 Answers
+ 4
Chibuzo Odigbo Here in your code you will have to multiply the age on earth by 365 to get the age in days on earth, then you have to divide it by 687 to get the age on mars.
Hope it helps.
Happy coding đ€
+ 3
I've done that but first show your trial code so that we can help.
+ 3
Chibuzo Odigbo
I didn't like Go, but I have also completed this challenge also.
As Adil has stated, please show your attempt so we may guide you to a solution
+ 2
Chibuzo Odigbo Yes.
Here is the code I did:
package main
import "fmt"
func main() {
var age int
fmt.Scanln(&age)
age*=365
age/=687
fmt.Println(age)
}
+ 2
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)
}
+ 1
package main
import "fmt"
func main() {
var age int
fmt.Scanln(&age)
mars_age:=age
mars := mars_age/2
fmt.Println(mars)
}
this is what my code looks like
+ 1
So, basically, I'll be giving earth an integer, and then divide that integer by the mars days?