Skip to content

Instantly share code, notes, and snippets.

@ouzdev
Created December 21, 2019 09:30
Show Gist options
  • Save ouzdev/66f2737d4c42a65c323ef90d90403bff to your computer and use it in GitHub Desktop.
Save ouzdev/66f2737d4c42a65c323ef90d90403bff to your computer and use it in GitHub Desktop.
4 işlemin metod türleri ile yapılması
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 dort_islem_metod
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Topla()
{
int sayi1 = Convert.ToInt32(txt_sayi_1.Text);
int sayi2 = Convert.ToInt32(txt_sayi_2.Text);
int sonuc = sayi1 + sayi2;
MessageBox.Show(sonuc.ToString());
}
public void Cikarma(int a, int b)
{
int sonuc = a + b;
MessageBox.Show(sonuc.ToString());
}
public double Carpma()
{
double sayi1 = Convert.ToInt32(txt_sayi_1.Text);
double sayi2 = Convert.ToInt32(txt_sayi_2.Text);
double islem = sayi1 * sayi2;
return islem;
}
public double Bolme(double a, double b)
{
double sonuc = a / b;
return sonuc;
}
private void btn_topla_Click(object sender, EventArgs e)
{
Topla();
}
private void btn_cikar_Click(object sender, EventArgs e)
{
int sayi1 = Convert.ToInt32(txt_sayi_1.Text);
int sayi2 = Convert.ToInt32(txt_sayi_2.Text);
Cikarma(sayi1, sayi2);
}
private void btn_carpma_Click(object sender, EventArgs e)
{
string metin = Carpma().ToString();
MessageBox.Show(metin);
}
private void btn_bolme_Click(object sender, EventArgs e)
{
double sayi1 = Convert.ToInt32(txt_sayi_1.Text);
double sayi2 = Convert.ToInt32(txt_sayi_2.Text);
string metin = Bolme(sayi1, sayi2).ToString();
MessageBox.Show(metin);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment