program to
print factorial number.
-----------------------------------------DESIGN-----------------------------------------------------
<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="Factorial.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">
<h1>Factorial Number</h1>
<asp:LabelID="Label1"runat="server"Text="Enter
the numeber :"></asp:Label>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><br/>
<br/>
<asp:ButtonID="Button1"runat="server"Text="Ok"/><br/>
<h2>
<asp:LabelID="Label2"runat="server"style="background-color:Gray"></asp:Label></h2>
</form>
</body>
</html>
-----------------------------------------code---------------------------------------------------------
PartialClass _Default
Inherits
System.Web.UI.Page
ProtectedSub
Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles
Button1.Click
Dim i AsInteger
Dim mul AsInteger
mul = 1
i = TextBox1.Text
While (i >=
1)
mul = mul * i
i = i - 1
EndWhile
Label2.Text = "factorial
of " + TextBox1.Text + " is:
"& +mul
EndSub
EndClass-----------------------------------------output----------------------------------------------------
codestrew |
No comments:
Post a Comment