Go Program to Print Alphabets from a to z

In this Go program, we used the for loop to iterate a to z and print the alphabets between lowercase a to z.

package main

import (
    "fmt"
)

func main() {

    for ch := 'a'; ch <= 'z'; ch++ {
        fmt.Printf("%c   ", ch)
    }
    fmt.Println()
}
Go Program to Print Alphabets from a to z 1

This Golang Program uses the ASCII codes within the for loop to print Alphabets from a to z.

package main

import (
    "fmt"
)

func main() {

    for ch := 97; ch <= 122; ch++ {
        fmt.Printf("%c   ", ch)
    }
    fmt.Println()
}
a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z 

This Go example allows the user to enter the starting character and prints the alphabets from the given character to z.

package main

import (
    "bufio"
    "fmt"
    "os"
)

func main() {

    reader := bufio.NewReader(os.Stdin)

    fmt.Print("Enter the Starting  Character = ")
    stch, _ := reader.ReadByte()

    for ch := stch; ch <= 'z'; ch++ {
        fmt.Printf("%c  ", ch)
    }
    fmt.Println()
}
Enter the Starting  Character = l
l  m  n  o  p  q  r  s  t  u  v  w  x  y  z