0% found this document useful (0 votes)
10 views2 pages

Practical 2 A

Uploaded by

chaudharyma648
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Practical 2 A

Uploaded by

chaudharyma648
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

2 Label

1 TextBox

1 Button(Double Click and program)

FACTORIAL:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

class fact
{
public int n, f;
public fact()
{
f = 1;
}
public void cal()
{
int i;
for(i = 1; i <= n; i++)
{
f = f * i;
}
}
}
namespace factorial2a
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
fact f1=new fact();
f1.n = int.Parse(TextBox1.Text);
f1.cal();
Label2.Text = f1.f.ToString();
}
}
}

You might also like