Ask Question
28 November, 16:05

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)

+2
Answers (1)
  1. 28 November, 16:24
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers