FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 109   



Following program shows you how to print table for given number.
In this program we get number from user and print that number table using for loop

package main

import "fmt"

func main() {

  var input int
  fmt.Println("Enter the number:")
  fmt.Scanf("%d", &input)
  for i := 1; i <= 10; i++ {
    fmt.Println(input , " * " , i , " = " , input * i)
  }
}

Output:

Enter the number:
 12
12  *  1  =  12
12  *  2  =  24
12  *  3  =  36
12  *  4  =  48
12  *  5  =  60
12  *  6  =  72
12  *  7  =  84
12  *  8  =  96
12  *  9  =  108
12  *  10  =  120



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News