Pages

Minggu, 29 Maret 2015

PROGRAM MENCARI KONVERSI SUHU DARI CELCIUS KE SUHU LAIN DENGAN C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double celcius;
            double fahrenheit;
            double reamur;
            double kelvin;
       
         
            if (radioButton1.Checked == true)
            {
                celcius = Convert.ToDouble(textBox1.Text);
                reamur = celcius * 4 / 5;
                textBox2.Text = reamur.ToString();
            }
            else
            {

                if (radioButton2.Checked == true)
                {
                    celcius = Convert.ToDouble(textBox1.Text);
                    kelvin = celcius + 273;
                    textBox2.Text = kelvin.ToString();

                }
                else
                {
                    celcius = Convert.ToDouble(textBox1.Text);
                    fahrenheit = (celcius + 32) * 9 / 5;
                    textBox2.Text = fahrenheit.ToString();
               
                }

            }
           

        }
    }
}


0 komentar:

Posting Komentar