ASP.Net with VISUAL C#
Use an appropriate looping statment to write a program that
prints a list of the Celsius equivalents of zero degrees Fahrenheit
through100 degrees Fahrenheit. To convert Fahrenheit to Celsius,
subtract 32 from the Fahrenheit temperature, and then multiply the
remainder by .55.
ASP.Net Code:
File: Site.Master.designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect
behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace temperaturesConversion {
public partial class SiteMaster {
///
<summary>
/// HeadContent
control.
///
</summary>
///
<remarks>
/// Auto-generated
field.
/// To modify move field
declaration from designer file to code-behind file.
///
</remarks>
protected
global::System.Web.UI.WebControls.ContentPlaceHolder
HeadContent;
///
<summary>
/// MainContent
control.
///
</summary>
///
<remarks>
/// Auto-generated
field.
/// To modify move field
declaration from designer file to code-behind file.
///
</remarks>
protected
global::System.Web.UI.WebControls.ContentPlaceHolder
MainContent;
}
}
File: Default.aspx.designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect
behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace temperaturesConversion {
public partial class _Default {
///
<summary>
/// conversionTable
control.
///
</summary>
///
<remarks>
/// Auto-generated
field.
/// To modify move field
declaration from designer file to code-behind file.
///
</remarks>
protected
global::System.Web.UI.WebControls.Table conversionTable;
}
}
File: Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace temperaturesConversion
{
public partial class _Default :
System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
for (int i = 0; i <= 100; i++)
{
//Creating a Row
TableRow row = new TableRow();
//Creating cells
TableCell fh = new TableCell();
TableCell cel = new TableCell();
//Adding text to cells
fh.Text = i.ToString();
cel.Text = ( (i - 32) * 0.55 ).ToString() ;
//Adding cells to current row
row.Cells.Add(fh);
row.Cells.Add(cel);
//Adding row to table
conversionTable.Rows.Add(row);
}
}
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------
Sample Run:
Get Answers For Free
Most questions answered within 1 hours.