Introduction
This is a scientific calculator that calculates fibonacci modulo factorial sin cos tan.. you are also able to change the background color and color of the buttons.
Using the Code
private void button1_Click(object sender, EventArgs e)
{
but_backspace.Enabled = true;
but_backspace.BackColor = Color.LightCoral;
if (isOperation == true)
{textBox_output.Text = "";}
if (tempSign == "Sminus")
{ textBox_output.Text += "-1"; }
else
textBox_output.Text += "1";
isOperation = false;
}
private void button12_Click(object sender, EventArgs e)
{
if (textBox_output.Text == "")
{
}
else
{
Operations.add(double.Parse(textBox_output.Text));
textBox_output.Text = Convert.ToString(Operations.getResult());
isOperation = true;
tempSign = "plus";
}
}
public static long factorial(long num)
{
if(num >= 21 || num < 0)
{
MessageBox.Show("Enter number between 0 & 20",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return 0;
}
else
{
if(num <= 1)
return 1;
else
return num * factorial(num - 1);
}
}
History
- 11th March, 2008: Initial post