See Our team

Wondering how we keep quality?

Got unsolved questions?

Ask Questions

Engineering
GATE
CBSE
NCERT
Psychology
English
Computer
Constitution
Astrology
Yoga
Economics
Physics
Biology
Electronics
Microprocessor
Career
Interview
Anatomy
Botany

You are here:Open notes-->VTU-->Web-programming-laboratary-manual-10csl78

**Web programming laboratary manual 10csl78**

Develop and demonstrate a javascript program that execute the following programs.

1a) Input a n numbers using the input and output the Fibonacci series of that number.

1b) Input a n numbers using the input and output the series of that number with the squire root of that number.

**1a)**

**<html>**

**<head>**

**<script>**

**var x=prompt("Enter the numbers has to be generated");**

**var n=parseInt(x)+1;**

**var i;**

**var fib = []; //Initialize array!**

**fib[0] = 0;**

**fib[1] = 1;**

**for(i=2; i<=n; i++)**

**{**

**// Next fibonacci number = previous + one before previous**

**// Translated to JavaScript:**

**fib[i] = fib[i-2] + fib[i-1];**

**alert(fib[i]);**

**}**

**</script>**

**</head>**

**</body>**

**</html>**

**1b)**

**<html>**

**<head>**

**<script>**

**var x=prompt("Enter the numbers to be generated");**

**var i=0;**

**var j=0;**

**for(i=0;i<=x;i++){**

**alert(i);**

**alert("Squre :"+i*parseInt(i));**

**}**

**</script>**

**</head>**

**</body>**

**</html>**

## Use Me ?