Skip to content

Instantly share code, notes, and snippets.

@ehrktia
Created July 31, 2019 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehrktia/92d6abd3242531e457ca68c4d6627ba9 to your computer and use it in GitHub Desktop.
Save ehrktia/92d6abd3242531e457ca68c4d6627ba9 to your computer and use it in GitHub Desktop.
multiply using recursion
package main
import "fmt"
func col(i int) {
fmt.Printf(" %d", i)
row(i, 2)
fmt.Println("")
i++
if i <= 12 {
col(i)
}
}
func row(i, j int) {
if i <= 12 {
fmt.Printf(" %d", i*j)
}
j++
if j <= 12 {
row(i, j)
}
}
func main() {
col(1)
}
@ehrktia
Copy link
Author

ehrktia commented Jul 31, 2019

multiply using recursion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment