Click here to Skip to main content
12,692,718 members (33,597 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


50 bookmarked

Scientific Calculator

, 11 Mar 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Scientific calculator that calculates fibonacci modulo factorial sin cos tan.. you are able to also change background color and color of the buttons


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

// using button number 1
private void button1_Click(object sender, EventArgs e)
    but_backspace.Enabled = true;        // number button is clicked, enable backspace
    but_backspace.BackColor = Color.LightCoral; // color button when enabled

    if (isOperation == true)          // if we used an operation clear output
        {textBox_output.Text = "";}   // empty output

    if (tempSign == "Sminus")
        { textBox_output.Text += "-1"; }

        textBox_output.Text += "1";    // add 1 to output
        isOperation = false;           // no operation pressed yet

// using addition button
private void button12_Click(object sender, EventArgs e)
    if (textBox_output.Text == "")
    { // to prevent exception appearing
        textBox_output.Text = Convert.ToString(Operations.getResult());
        isOperation = true; // user pressed an operation
        tempSign = "plus";

// factorial method
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;
        if(num <= 1)
            return 1;
            return num * factorial(num - 1); // recursive function


  • 11th March, 2008: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Liberia Liberia
No Biography provided

You may also be interested in...

Comments and Discussions

JokeChange "." for "," Pin
Ángel Manuel García Carmona21-Dec-10 11:43
memberÁngel Manuel García Carmona21-Dec-10 11:43 
Hello, i have found a mistake in the code of your app. When i click in the decimal separator' button, the character "." was written, but if i clicked in an operator (+, -, ...), the separator was dropped, being incorrect the operations, but if in the code, you replace "." for "," where corresponds, you shouldn't have problems.
Also, your article it's excellent for beginners.


General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170118.1 | Last Updated 11 Mar 2008
Article Copyright 2008 by Ramzi987654321
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid