Ask Question
24 May, 18:53

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)

+3
Answers (1)
  1. 24 May, 19:08
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers