1 Ekim 2014 Çarşamba

Metodlarla Dört işlem Yapma

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();
        }

    
        public int topla(int s1, int s2)
        {
            int sonuc;
           sonuc = s1 + s2;

           return sonuc;

        }
         public  int cıkar(int s1, int s2)
        {

            return s1 - s2;

        }
         public int carp(int s1, int s2)
        {

            return s1 * s2;

        }
          public int bol(int s1, int s2)
        {

            return s1 /s2;

        }




        private void button3_Click(object sender, EventArgs e)
        {
         textBox3 .Text = carp (Convert.ToInt16(textBox1.Text), Convert.ToInt16(textBox2.Text)).ToString ();
      
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {

           textBox3 .Text = topla(Convert.ToInt16(textBox1.Text), Convert.ToInt16(textBox2.Text)).ToString ();
        }

        private void button2_Click(object sender, EventArgs e)
        {
           textBox3 .Text = cıkar(Convert.ToInt16(textBox1.Text), Convert.ToInt16(textBox2.Text)).ToString ();
        }

        private void button4_Click(object sender, EventArgs e)
        {
              textBox3 .Text =bol (Convert.ToInt16(textBox1.Text), Convert.ToInt16(textBox2.Text)).ToString ();
    }
        }
        }

Kodun Çalıştırılmış Hali


Hiç yorum yok:

Yorum Gönder