How to Calculate Your Age on Mars With GOLANG

How to Calculate Your Age on Mars With GOLANG

Hello everyone, today i want to show you about How to Calculate Your Age on Mars With GOLANG

today i want to make a tutorials about how to calculate your age on mars with Go!, Its very simple and easy but is funny.

Okey let go!

1. make Folder and Go file

i make folder to save this tutorials, and make a go file with name main.go

2. Then, we start coding!

In file main.go , create "package main" in the top main.go

k6j1p450l4tzcsax3gq3.jpg

3. step 3, make the contents the code

After create "Package main", next we make a import "fmt" under package main.

import package

make a function main and variabel with name "age" and with type int is for interger, after make variabel we make a output for to tell the user to enter a number

vh0dx26amyndt9db6jk8.jpg

4. Make input for user

Now we make a input field for user with fmt.Scaln , which receives the address of the age variable using a pointer

pvovbvliffn3xna791mw.jpg

5.Make a formula for calculating age on mars

Lest go for make a formula for calculating age on mars, the formula is like this

oqatw7pquu51hbeqltuo.jpg

after make this formula, next we to print of result from formula, this way

c49m2u60ffkgbb447tcn.png

the parts print the result of the formula, we take the data from mars and then parse it

6. final result

we run the code with "go run main.go"

9t2gun7j35rw66xuwykx.png

if you want to see my code, this is my code in my repository in Github

End

and that's my tutorial on how to calculate age on mars, thank you and don't forget to like and share

ย