Ask Question
23 May, 23:11

Write the program code to find the cube of numbers from 1-5. Also do the dry run by using the trace table. (jа vascript)

+5
Answers (1)
  1. 23 May, 23:28
    0
    Following are the jа vascript program

    var k, t; / / variable declaration

    for (k = 1; i < 6; k++) / / iterating the loop

    {

    t=k*k*k; / / find the cube of number

    document. write (k); / / display the cube root

    document. write (" < / br> "); / / moves to the next line

    }

    Output:

    1

    8

    27

    64

    125

    Explanation:

    We used the script tag for creating the jа vascript program. Declared the variable "k" in the script tag. Iterating the for loop. In the for loop the k variable is initialized by the 1 This loop is executed less then 6. In each iteration we find the cube of number in the "t" variable and display that number by using document. write ().
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write the program code to find the cube of numbers from 1-5. Also do the dry run by using the trace table. (jа vascript) ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers