0% found this document useful (0 votes)
4 views5 pages

Exam Programm

The document contains multiple examples of ASP.NET web forms for performing basic calculations. Each example includes a page that allows users to input values and receive outputs for operations such as summing two numbers, calculating the area of a triangle, computing Body Mass Index (BMI), and determining grades based on four subjects. Each example features a button to clear the input fields after calculations.

Uploaded by

mohamedliban972
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)
4 views5 pages

Exam Programm

The document contains multiple examples of ASP.NET web forms for performing basic calculations. Each example includes a page that allows users to input values and receive outputs for operations such as summing two numbers, calculating the area of a triangle, computing Body Mass Index (BMI), and determining grades based on four subjects. Each example features a button to clear the input fields after calculations.

Uploaded by

mohamedliban972
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/ 5

Exmaple 1: sum of two number

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class sum : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs
e)
{

}
protected void Button1_Click(object sender,
EventArgs e)
{
int a, b, c;
a = Convert.ToInt32(TextBox1.Text);
b = Convert.ToInt32(TextBox2.Text);
c = a + b;
TextBox3.Text = Convert.ToString(c);
}
}
Example 2: Area of Trianle
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public partial class sum : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

int Base, height, area;

Base = Convert.ToInt32(TextBox1.Text);

height = Convert.ToInt32(TextBox2.Text);

area = (Base * height) / 2;

TextBox3.Text = Convert.ToString(area);

protected void Button2_Click(object sender, EventArgs e)

TextBox1.Text = " ";

TextBox2.Text = " ";

TextBox3.Text = " ";


}

Example 3: Body Mass Index

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public partial class sum : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

double weight, height, BMI;

weight = Convert.ToDouble(TextBox1.Text);

height = Convert.ToDouble(TextBox2.Text);

BMI = (weight / (height * height));

TextBox3.Text = Convert.ToString(BMI);

protected void Button2_Click(object sender, EventArgs e)

{
TextBox1.Text = " ";

TextBox2.Text = " ";

TextBox3.Text = " ";

Example 4: Grading system

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class sum : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
double sub1, sub2, sub3, sub4, total, average;
sub1 = Convert.ToDouble(TextBox1.Text);
sub2 = Convert.ToDouble(TextBox2.Text);
sub3 = Convert.ToDouble(TextBox3.Text);
sub4 = Convert.ToDouble(TextBox4.Text);
total = sub1 + sub2 + sub3 + sub4;
average = total / 4;
TextBox5.Text = Convert.ToString(total);
TextBox6.Text = Convert.ToString(average);
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = " ";
TextBox2.Text = " ";
TextBox3.Text = " ";
}
}

You might also like