Selasa, 15 November 2016

Program Konversi Suhu

Langsung saja..
Berikut program konversi suhu celcius, fahrenheit dan kelvin

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 Suhu_Pertemuan_Pa_Friska
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();


        }

        private void btnclear_Click(object sender, EventArgs e)
        {
            txtcelcius.Clear();
            txtfahrenheit.Clear();
            txtkelvin.Clear();
        }

        private void txtcelcius_TextChanged(object sender, EventArgs e)
        {
            if (txtcelcius.Text != "")
            {

                double x, f, k;
                x = Convert.ToDouble(txtcelcius.Text);
                f = (x * 9 / 5) + 32;
                k = x + 237;
                txtfahrenheit.Text = f.ToString();
                txtkelvin.Text = k.ToString();
            }
        }
    }
}



0 komentar:

Posting Komentar

 

Siti Mulia Sari Template by Ipietoon Cute Blog Design