Menu Close

Go – Program to Check Whether a Number is Palindrome or Not in go golang.

In this article, We are going to learn about code and algorithm to check whether a number is palindrome or not in go golang. A palindrome number is a number which remains the same when it’s digits are reversed

There are many ways to to check whether a number is palindrome or Not in go golang



1331 is a palindrome number because reverse of 1331 is 1331.

123 is not a palindrome number because reverse of 123 is 321 . After reversing the number, they are not equal.


  • Get the number as input from user.
  • Reverse the number and store into a temp variable.
  • Compare temp variable to number. If both are equal then it is a palindrome number else not.


package main

import "fmt"

func main(){

    var number int

    var reverse_no int = 0

    fmt.Print("Enter the number: ")


    tmp_number := number

    for {
        remainder := tmp_number % 10

        reverse_no = reverse_no * 10 + remainder

        tmp_number = tmp_number / 10

       if (tmp_number == 0) {




    if (reverse_no == number) {

        fmt.Printf("%d is a palindrome number", number)

    } else {

        fmt.Printf("%d is not a palindrome number", number)



 Enter the number: 121
121 is a palindrome number.

Enter the number: 132
132 is not a palindrome number.


To learn more about golang, Please follow given below link:
Posted in golang, golang program

Leave a Reply

Your email address will not be published. Required fields are marked *