Convert the temperature from Fahrenheit to Celsius:
Object: Write a C# program windows form application that temperature conversion program that converts from Fahrenheit to Celsius. The Fahrenheit temperature should be entered from the keyboard. C# windows form application projects with source code.
Fahrenheit to Celsius Formula:
(((f – 32)) * 5 / 9);
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace code
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
ans.Text = “0”;
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
double con, f;
f = Convert.ToDouble(textBox1.Text);
con = (((f – 32)) * 5 / 9);
ans.Text = con.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace code
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
ans.Text = "0";
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
double con, f;
f = Convert.ToDouble(textBox1.Text);
con = (((f - 32)) * 5 / 9);
ans.Text = con.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Output:
Create a Simple Calculator in C# Windows form Application with Source Code