-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab1a.html
More file actions
34 lines (34 loc) · 755 Bytes
/
lab1a.html
File metadata and controls
34 lines (34 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript">
function calculation()
{
var x= prompt("Enter the value of fibonici");
x=parseInt(x);
var y1=0,i,y2=1,res;
if(x<0||x==0)
{
document.write("Series not possible");
}
if(x==1)
{
document.write(y1);
}
if(x>1)
{
document.write(y1,"   ",y2);
}
for(i=2;i<x;i++)
{
res= y1+y2;
y1=y2;
y2=res;
document.write("   ",res);
}
}
</script>
</head>
<body onload="calculation()"></body>
</html>