Area and Circumference of Circle Using javascript
In this article, we are going to learn how to calculate the area and circumference of a circle using javascript. In this program, we are going to use prompt () to input data and calculate area and circumference without using function and event.
Formula:
Area=PI X radius X radius
Circumference=2 X PI X radius
Note: In the Greek letter PI (Ï€) represents a constant, approximately equal to 3.14159. The result will display in the floating point.
Source Code:
Explanation:
Output:
Final Words:
I hope you understood how to calculate the Area and Circumference of Circle Using javascript. In the next article, we are going to solve the same problem by using functions and buttons. If you have any suggestions, please feel me to write it comment box.
You may also like:
if..else if..else statement in JavaScript
if..else Statement in JavaScript
No comments:
Post a Comment