How can I create a custom calculator on a drupal site?
I see you've tagged this question with JavaScript, so it looks like you want to make a calculator using JavaScript.

To do this, you could make a custom module.

Create a module called calcform.
Create calcform.js
In your calcform.module you could create a custom block that has the calcform form.

You'll need to checkout: Creating modules | Block examples

function calcform_form(&amp;$form, &amp;$form_state){
  $form['number1'] = array(
    '#type'=&gt;'textfield',
  );
  $form['number2'] = array(
    '#type'=&gt;'textfield',
  );
  $form['calc_button'] = array(
    '#type'=&gt;'button',
    '#value'=&gt;'Calculate',
  );
  return $form;
}


Then in your JavaScript:

(function($){

  Drupal.calcform = {}

  Drupal.behaviors.calcform = {
    attach:function(){
      Drupal.calcform.bindEvents();
    }
  }

  Drupal.calcform.bindEvents = function(){

    $('#calc-button').click(function(e){
      // Prevent default button from submitting the form.
      e.preventDefault();
      // Do your magic here.
    });  

  }

}(jQuery));


This is all very pseudo-cody, but it's the general idea.
You actually don't need to write ANY JavaScript. You could create a form submit function that does the calculations and prints out the result to the form. You can then use the $form['#ajax'] capabilities to do all the magic for you.

Drupal is amazing like that.