program to check number is palindrome or not.
-----------------------------------------DESIGN-----------------------------------------------------
<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="Default.aspx.vb"Inherits="_Default"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML
1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
</head>
<body>
<formid="form1"runat="server">
<divstyle="font-family: AngsanaUPC; font-size:
x-large; font-weight:
bolder; font-style:
italic; font-variant:
normal; text-transform:
uppercase; color:
#000000; background-color:
#FFFFFF">
<H1> PALINDROM
OR NOT</H1><br/>
enter any number<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<br/>
<asp:ButtonID="Button1"runat="server"Text="ok"/>
<br/>
<asp:LabelID="Label1"runat="server"></asp:Label>
</div>
</form>
</body>
</html>
-----------------------------------------code---------------------------------------------------------
PartialClass _Default
Inherits
System.Web.UI.Page
Dim n, temp,
a, rev AsInteger
ProtectedSub
Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles
Button1.Click
n = TextBox1.Text
temp = n
While (n > 0)
a = n Mod
10
rev = (rev * 10) + a
n = n / 10
EndWhile
If (temp =
rev) Then
Label1.Text = "Number is palindrom"
TextBox1.Text = ""
TextBox1.Focus()
Else
Label1.Text = "Number is not palindrom"
TextBox1.Text = ""
TextBox1.Focus()
EndIf
EndSub
EndClass-----------------------------------------output----------------------------------------------------
codestrew |
No comments:
Post a Comment