Input: A number n obtained using prompt
Output: A table of numbers from 1 to n and their squares
Input – a screenshot of the browser.
Output showing squares for 1 to 5.
Output 2 – shows squares of 1 to 15
How to execute this script?
- Copy the code and save it in a text file with a .html extension.
- Open the same file through the browser.
- You will be asked to enter a number and result will be displayed.
- To check for another number, refresh the page and again enter a new number.