Can any one tell me how to make a program to Generate Palindromic numbers?

Recommended Answers

All 5 Replies

Give it a try and post your attempt (with more details) and we can help.

This is what i have. It generates prime numbers but i need it to be palindromic.

Public Class Form1
Private Sub btnPrime_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrime.Click
        Dim n As Integer
        Dim min As Integer
        Dim max As Integer
        
        min = txtbox1.Text
        max = txtbox2.Text
        For i = min To max
            If IsPrime(i) = True Then
                lstDisplay.Items.Add(i)
            End If
        Next
    End Sub
    Private Function IsPrime(ByVal number As Long) As Boolean
        Dim i As Integer
        If number = 2 Then
            Return True
        Else
            If number = 1 Then
                Return False
            ElseIf number > 2 Then
                For i = 2 To number - 2
                    If number Mod i = 0 Then
                        Return False
                    End If
                Next
            End If
        End If
        Return True
    End Function
End Class

You obviously ignored every reference to CODE tags all over the place. Even the one that smacks you in the face when you type in your messages!

I also see no attempt at all to test if a number is palindromic. Since prime and palindrome have nothing to do with each other, you have not even made an attempt. Please reread the Member Rules.

Well i added

If i = StrReverse(i) Then

and it worked.
Thanks anyway, i suppose...

Well, there you go. You tried something and it worked! Congrats.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.