English
Tamil Nadu Board of Secondary EducationHSC Science Class 11

Write a program in JavaScript to find the cube of a number using function. - Computer Applications

Advertisements
Advertisements

Question

Write a program in JavaScript to find the cube of a number using function.

Answer in Brief

Solution

<html>
<head>
<title> print the cube number
</title>
</head>
<Title>
Function cube</Title>
<Script type = “text/Javascript”>
<!—
var input = window.prompt (“Enter value : ”, “0”);
var v = parselnt (input); var c = cube (v);
document, write In (“<br><h4><u> cube function </u> </h4>”);
document, write In (“Number *V* “<br> The cube =” *C);
function cube (x)
{
var cube = x* x * x; return c;
}
//–>
</script>
</head>
<body>
</body>
</html>

OUTPUT
Enter value: 5
Cube Function Number: 5
The cube: 125

shaalaa.com
JavaScript Functions
  Is there an error in this question or solution?
Chapter 16: JavaScript Functions - Evaluation [Page 336]

APPEARS IN

Samacheer Kalvi Computer Applications [English] Class 11 TN Board
Chapter 16 JavaScript Functions
Evaluation | Q 1. | Page 336
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×