Hi there! Welcome to Day 5 of 30 days of code in Go! One interesting thing about loops in Go is that there is only one looping construct: for. This challenge will receive an integer input $N$ and it will print results of the form $N\times i = \mathrm{result}$, where $1 \le i \le 10$. By the way, there was a loop on the last day of code, but it was actually part of the given code. The one for today will be quite similar.

My solution is

package main

import "fmt"

func main() {
  var N int
  fmt.Scan(&N)

  for i := 1; i <= 10; i++ {
    fmt.Printf("%d x %d = %d\n", N, i, i*N)
  }
}

And the output:

$ go run day_05.go
# input
5
# output
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

That’s all for today, thanks for reading!