write a program in JavaScript to find area of a circle
Answers
Answered by
15
JavaScript program :
Explanation:
var value=parseInt(prompt("Enter the number to fild the area of a circle"));// take the input from the user
document.write("The area of a circle is "+(22/7)*value*value)//print the value of area.
Output :
- If the user input as 1, then it will print as "3.142857142857143".
- If the user input as 2, then it will print as "12.571428571428571".
Code Explanation :
- The above code is in javascript language which has the one input function which opens the dialog box and takes input and then calculates the area of a circle with the help of formula.
- When the user wants to run the above program, then he needs to add this program on the HTML file or in any javascript editor.
Learn More :
- JavaScript : https://brainly.in/question/9980021
Similar questions