You are on page 1of 1

D:\7 sem\web lab\1a.

html Monday, August 11, 2014 7:38 AM


<?xml version=1.0 encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Lab Program 2a</title>
<script type="text/javascript">
fibonacci()
f unct i on fibonacci(){
a=0
b=1
c=0
n = prompt("Number of terms of fibonacci series:");
fib="0"
i f (n == 1)
alert(fib);
el se i f (n == 2){
fib=fib+" 1"
alert(fib)
}
el se i f (n > 2){
fib=" 0 \n 1 \n "
f or (i=3;i<=n;i++){
c=a+b
fib=fib+c+" \n "
a=b
b=c
}
alert(fib)
}
el se
alert("Wrong Number please enter a number > 0")
}
</script>
</head>
<body>
</body>
</html>
-1-

You might also like