public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string uslusayi(int taban,int ust)
{
int a=1;
for (int i = 1; i <=ust; i++)
{
a = a *taban;
}
return a.ToString();
}
string fak(int fak)
{
int sayi,i;
sayi = 1;
for ( i = 1; i <= fak; i++)
{
sayi = sayi * i;
}
return sayi.ToString();
}
string topla(int a,int b )
{
int c;
c = a + b;
return c.ToString();
}
string cikar(int a,int b)
{
int c;
c = a - b;
return c.ToString();
}
string bol(int a,int b)
{
int c;
c = a / b;
return c.ToString();
}
string carp(int a,int b)
{
int c;
c = a * b;
return c.ToString();
}
string faizhesep(decimal anapara,int faiz,int vade)
{
decimal hesap;
hesap = (anapara * faiz * vade) / 36500;
hesap = hesap + anapara;
return hesap.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
if(radioButton6.Checked==true)
{
if(radioButton1.Checked==true)
{
label4.Text = uslusayi(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
}
else
if(radioButton2.Checked==true)
{
label4.Text = fak(Convert.ToInt32(textBox1.Text));
}
else
if(radioButton3.Checked==true)
{
if(comboBox1.Text=="+")
{
label4.Text = topla(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
}
else if(comboBox1.Text=="-")
{
label4.Text = cikar(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
}
else if(comboBox1.Text=="/")
{
label4.Text = bol(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
}
else if(comboBox1.Text=="*")
{
label4.Text = carp(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
}
}
else
if(radioButton4.Checked==true)
{
label4.Text = faizhesep(Convert.ToDecimal(textBox1.Text), Convert.ToInt32(textBox2.Text), Convert.ToInt32(textBox3.Text));
}
}
if (radioButton5.Checked == true)
{
if (radioButton1.Checked == true)
{
int taban, ust, sonuc;
sonuc = 1;
taban = Convert.ToInt32(textBox1.Text);
ust = Convert.ToInt32(textBox2.Text);
for (int i = 1; i <= ust; i++)
{
sonuc = sonuc * taban;
}
label4.Text = "" + sonuc;
}
else if (radioButton2.Checked == true)
{
int i, sayi, fakt = 1;
sayi = Convert.ToInt32(textBox1.Text);
for (i = 1; i <= sayi; i++)
{
fakt = fakt * i;
}
label4.Text = "" + fakt;
}
else if (radioButton3.Checked == true)
{
if (comboBox1.Text == "+")
{
int a, b, c;
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToInt32(textBox2.Text);
c = a + b;
label4.Text = "" + c;
}
else if (comboBox1.Text == "-")
{
int a, b, c;
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToInt32(textBox2.Text);
c = a - b;
label4.Text = "" + c;
}
else if (comboBox1.Text == "*")
{
int a, b, c;
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToInt32(textBox2.Text);
c = a * b;
label4.Text = "" + c;
}
else if (comboBox1.Text == "/")
{
int a, b, c;
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToInt32(textBox2.Text);
c = a / b;
label4.Text = "" + c;
}
}
else if (radioButton4.Checked == true)
{
decimal anapara = Convert.ToDecimal(textBox1.Text);
int faiz = Convert.ToInt32(textBox3.Text);
int vade = Convert.ToInt32(textBox2.Text);
decimal hesap = (anapara * faiz * vade) / 36500;
hesap = hesap + anapara;
label4.Text = hesap.ToString();
}
}
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
label4.Text = "Sonuç";
label1.Text = "1.Sayı";
label2.Text = "2.Sayı";
textBox1.Visible = true;
textBox3.Visible = false;
label5.Visible = false;
comboBox1.Visible = false;
label3.Visible = false;
label2.Visible = true;
textBox2.Visible = true;
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
label4.Text = "Sonuç";
label1.Text = "1.Sayı";
label2.Text = "2.Sayı";
textBox1.Visible = true;
comboBox1.Visible = false;
label3.Visible = false;
label2.Visible = false;
textBox2.Visible = false;
textBox3.Visible = false;
label5.Visible = false;
}
private void button3_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
label4.Text = "Sonuç";
label1.Text = "1.Sayı";
label2.Text = "2.Sayı";
comboBox1.Visible = true;
label3.Visible = true;
label2.Visible = true;
textBox2.Visible = true;
textBox1.Visible = true;
textBox3.Visible = false;
label5.Visible = false;
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
comboBox1.Visible = false;
label3.Visible = false;
label2.Visible = true;
textBox2.Visible = true;
textBox3.Visible = true;
label5.Visible = true;
textBox1.Visible = true;
label1.Text = "Anapara";
label2.Text = "Vade";
}
private void button2_Click(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
textBox1.Text = "";
textBox2.Text = "";
label4.Text = "Sonuç";
label1.Text = "1.sayi";
label2.Text = "2.sayi";
textBox1.Visible = true;
textBox2.Visible = true;
}
if (radioButton2.Checked == true)
{
label4.Text = "Sonuç";
label1.Text = "1.sayi";
textBox1.Text = "";
label1.Visible = true;
textBox1.Visible = true;
textBox2.Visible = false;
label2.Visible = false;
}
if (radioButton3.Checked == true)
{
label4.Text = "Sonuç";
label1.Text = "1.sayi";
label2.Text = "2.sayi";
textBox1.Text = "";
textBox2.Text = "";
comboBox1.Visible = true;
label3.Visible = true;
comboBox1.Text = "";
}
else
{
comboBox1.Visible = false;
label3.Visible = false;
}
if (radioButton4.Checked == true)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox3.Visible = true;
label5.Visible = true;
label1.Text = "Anapara";
label2.Text = "Vade";
label4.Text = "Sonuç";
}
else
{
textBox3.Visible = false;
label5.Visible = false;
}
Hiç yorum yok:
Yorum Gönder