• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Math Related / Circumference Calculator

Circumference Calculator

Circumference Calculator

Find out the circumference of a circle by entering its radius. Very simple!

<!– Paste this code into an external JavaScript file named: calc.js  –>

/* This script and many more are available free online at
The JavaScript Source :: http://javascriptsource.com
Created by: Lee Underwood :: http://javascriptsource.com/ */

function circum() {
  var radius = prompt(“Enter the radius of the circle”,””);
  var circle = 2 * Math.PI * radius;
  alert(“The circumference is “+circle+”.”)
}
<!– Paste this code into the HEAD section of your HTML document.
     You may need to change the path of the file.  –>

<script type=”text/javascript” src=”calc.js”></script>
<!– Paste this code into the BODY section of your HTML document  –>

<form>
<input type=button value=”Calculate the circumference” onClick=”circum()”>
</form>
<p><div align=”center”>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”https://javascriptsource.com”>The JavaScript Source</a></font>
</div><p>

Math Related

Related Snippets:

  • Get the largest number from a set of numbers
  • Return the largest integer less than or equal to a number
  • Metric BMI Calculator
  • Weight Watchers Points Calculator

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers