Golang Program to convert Uppercase to Lowercase characters, using binary operator.

Go ProgrammingServer Side ProgrammingProgramming

Example

package main
import "fmt"
func main(){
   fmt.Printf("Printing Lowercase characters from Uppercase characters using OR operator: ")
   for ch:='A'; ch<='Z'; ch++ {
      fmt.Printf(string(ch | ' '))
   }
   fmt.Println()
   fmt.Printf("Printing Uppercase characters from Lowercase characters using
   AND operator: ")
   for ch:='a'; ch<='z'; ch++ {
      fmt.Printf(string(ch & '_'))
   }
}

Output

Printing Lowercase characters from Uppercase characters using OR operator:
abcdefghijklmnopqrstuvwxyz

Printing Uppercase characters from Lowercase characters using AND operator:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
raja
Published on 17-Mar-2021 11:18:51
Advertisements