Pages

Minggu, 29 Maret 2015

PROGRAM MENCARI NILAI MAX DARI 3 INPUT BILANGAN

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 bil1;
            double bil2;
            double bil3;
            double max;
            bil1 = Convert.ToDouble(textBox1.Text);
            bil2 = Convert.ToDouble(textBox2.Text);
            bil3 = Convert.ToDouble(textBox3.Text);


            if (bil1 > bil2)
            {
                if (bil1 > bil3)
                    max = bil1;
                else
                    max = bil3;
                textBox4.Text = max.ToString();
            }
            else if (bil1 > bil3)
            {
                if (bil1 > bil2)
                    max = bil1;
                else
                    max = bil2;
                textBox4.Text = max.ToString();
            }
            else if (bil2 > bil1)
            {
                if (bil2 > bil3)
                    max = bil2;
                else
                    max = bil3;
                textBox4.Text = max.ToString();
            }
           
        }
    }
}


1 komentar: