Question

Write a complete webpage with HTML and JavaScript at document level. 1) Read row and column...

Write a complete webpage with HTML and JavaScript at document level.
1) Read row and column number with prompt() function with proper exlanation.
2) Calculate first row * column Fibonacci numbers. Assume the Fibonacci sequence starts

with 1 and 1.
3) Display all first row * column Fibonacci numbers in a HTML table with row and column as

row and column numbers respectively. From 1, these number should be placed in ascending order from top to bottom in the table. In each row, the numbers should be placed from left to right.

Homework Answers

Answer #1

Here is the answer...

CODE:

<!DOCTYPE html>
<html>
<head>
   <title>fibo</title>
   <script type="text/javascript">
       function recursive_fibo(n)
       {
           if(n==0 || n==1)
           {
               return 1;
           }
           else
           {
               return recursive_fibo(n-1)+recursive_fibo(n-2);
           }
       }
       function fibo()
       {
           var row = parseInt(window.prompt("enter row number"));               //read row number
           var column = parseInt(window.prompt("enter column number"));       //read column number
           var i=0;
           var l=[];
           for(i;i<row*column;i++)                                               //iterate through numbers
           {
               l.push(recursive_fibo(i));                                       //calling recursive fibonocci with the numbers
           }

          
           //alert(row);
           //alert(column);
           //alert(l);
           var x="";
           x=x+"<table style=\"border:1px solid;\">";                       //creating table tag
           var k=0;
           for(var i=0;i<row;i++)
           {
               x=x+"<tr>";                                                   //creating tr tagt
               for(var j=0;j<column;j++)
               {
                   x=x+"<td style=\"border:1px solid; padding:20px;\">"+l[k++]+"</td>";   //push the fibonocci numbers into td
               }
               x=x+"</tr>";
           }
           x=x+"</table";
           document.getElementById("table").innerHTML=x;
          
       }
   </script>
</head>
<body onload="fibo()">
<div id="table"></div>
</body>
</html>

CODE Snapshot:

OUTPUT:

IF you have any doubts please COMMENT...

If you understand the answer please give THUMBS UP..

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
JAVASCRIPT/HTML: Please read 10 numbers that are listed below, edit the code given to sort the...
JAVASCRIPT/HTML: Please read 10 numbers that are listed below, edit the code given to sort the numbers from least to greatest, and then print those numbers. 10 numbers = { 9, 3, 2, 1, 10, 30, 4, 6, 7, 8} Submit the code and a screenshot of the output. [Reference JavaScript code] <html> <body> <H1>prompt()</h1> <p id="pro"></p> <script> // Array creation var num= new Array(); var ix = 0; // Read 10 numbers for (ix = 0; ix < 10;...
[Lab Task HTML/JAVASCRIPT] Please read 10 numbers that are list below, sort the numbers and then...
[Lab Task HTML/JAVASCRIPT] Please read 10 numbers that are list below, sort the numbers and then print those numbers. 10 numbers = { 9, 3, 2, 1, 10, 30, 4, 6, 7, 8} Output should have a sorted list [Reference JavaScript code] <html> <body>     <H1>prompt()</h1>     <p id="pro"></p>     <script>        // Array creation        var num= new Array();               var ix = 0;        // Read 10 numbers        for (ix = 0; ix < 10; ix++)...
Write the below code to use HTML and JavaScript. 1)Write a JavaScript program to create a...
Write the below code to use HTML and JavaScript. 1)Write a JavaScript program to create a new string from a given string changing the position of first and last characters. The string length must be greater than or equal to 1. 2)Write a JavaScript program to check whether a string starts with 'Java' and false otherwise
For this assignment, you will write a timer application in HTML and JavaScript. Your HTML document...
For this assignment, you will write a timer application in HTML and JavaScript. Your HTML document should contain the following elements/features: 1. HTML tags: a. An <input> tag labeled "Timer Duration" with the initial value 0 b. A <button> tag labeled "Start" 2. Script: When the user presses the button (1b), a function will begin that does the following: a. Reads the value from the input field (1a) b. Removes the <input> and <button> tags (1a & 1b) c. Creates...
Write a SELECT statement that returns one row for each general ledger account number that contains...
Write a SELECT statement that returns one row for each general ledger account number that contains three columns: The account_description column from the General_Ledger_Accounts table The count of the items in the Invoice_Line_Items table that have the same account_number. The sum of the line_item_amount columns in the Invoice_Line_Items table that have the same account_number Return only those rows where the count of line items is greater than 1. This should return 10 rows. Group the result set by the account_description...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the program title and programmer’s name. Then get the user’s name, and greet the user. • Prompt the user to enter the number of Fibonacci terms to be displayed. Advise the user to enter an integer in the range [1 .. 46]. • Get and validate the user input (n). • Calculate and display all of the Fibonacci numbers up to and including the nth...
1. Write a SELECT statement that answers this question: Which customers have ordered more than one...
1. Write a SELECT statement that answers this question: Which customers have ordered more than one product? Return these columns: The email_address column from the Customers table The count of distinct products from the customer’s orders table Sort the result set in ascending sequence by the email_address column. 2. Use a correlated subquery to return one row per customer, representing the customer’s oldest order (the one with the earliest date). Each row should include these three columns: email_address, order_id, and...
Section 1.1: Creating the First Table Locate the HTML comment that reads "table 1" just below...
Section 1.1: Creating the First Table Locate the HTML comment that reads "table 1" just below the opening body tag. Add a table tag with the following specifications using the style attribute and CSS: width with a value of 650 pixels a margin set to auto – this will center the table within the web page a border set to none - this removes the table border Add a table row (<tr>) Add a table data container tag (<td></td>) Within...
In HTML and Javacript: Create three columns. Column #1: Include input fields for the following... Text...
In HTML and Javacript: Create three columns. Column #1: Include input fields for the following... Text field (with labelling) to retrieve a student's FIRST name Text field (with labelling) to retrieve a student's last name Text field (with labelling) to retrieve a student's id (number) A checkbox for country designation with no check designating a "Domestic" student and checked designating an "International" student. A text field should be placed beside or under the check box with the text field containing...
Write a complete Java program to solve the following problem. Read two positive integers from the...
Write a complete Java program to solve the following problem. Read two positive integers from the user and print all the multiple of five in between them. You can assume the second number is bigger than the first. For example if the first number is 1 and the second number is 10, then your program should output 5 10 Note: There is a white space in between the numbers. Java programming please answer ASAP before 2:30