Showing posts with label palindrome. Show all posts
Showing posts with label palindrome. Show all posts

Saturday, March 10, 2012

Write a C program to check whether a given number is palindrome or not.

#include 
#include 
void main()
{
 long int n, num, rev = 0, dig;
 printf("\n Enter a number...: ");
scanf("%ld", &num);
 n = num;
while(num>0)
{
dig = num % 10;
 rev = rev * 10 + dig;
 num = num / 10;
 }
 if (n == rev)
 printf("\nGiven number is a palindrome");
 else
 printf("\n Given number not a palindrome");
 getch();
}

Tuesday, February 22, 2011

Write a Visual Basic Program to check given no. is Palindrome or not by using Form

WAP to check given no. is Palindrome or not by using Form.
_________________________________________________

Private Sub Command1_Click()
Dim a, b, c
a = Text1.Text
b = StrReverse(Text1.Text)
c = StrComp(a, b)
If (c = 0) Then
Text2.Text = "Given string is Palindrome!"
Else
Text2.Text = "Given Sting is not a Palindrome!"
End If
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""

End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()

End Sub


_____________________________________________
OUTPUT
_____________________________________________



____________________________________
DOWNLOAD
____________________________________

Download its form

Download its Image