3. (A) Using JavaScript design, a web page that prints factorial/Fibonacci series/any given series

3. (A) Using JavaScript design, a web page that prints factorial/Fibonacci series/any given series

Factorial Series:
<html>
<head>

</head>
<body>
Enter Num: <input id="num">
<button onclick="fact()">Factorial</button><br><br>
THE FACTORIAL OF NO. IS :<input id="ans">
<script>
function fact(){
var i, no, fact;
fact=1;
no=document.getElementById("num").value;
for(i=1; i<=no; i++)
{
fact= fact*i;
}
document.getElementById("ans").value= fact;
}
</script>
</body>
</html> Fibonacci series:
<html>
<head>
<script>
function myfun()
{
var a,b,c,n;
a=0;
b=1;
n=document.getElementById("abc").value;
c=0;
while (b <= n) {
document.write(c + " <br/>")
c = a + b;
a = b;
b = c;
}
}
</script>
</head>
<body>
<form>
ENTER THE NUMBER TO FIND THE FIBONACII SERIES : <input type="number" id="abc"> <br><br>
<input type="submit" value="Check !t" onclick="myfun()"><br>
</form>
</body>
</html>
3. (A) Using JavaScript design, a web page that prints factorial/Fibonacci series/any given series 3. (A) Using JavaScript design, a web page that prints factorial/Fibonacci series/any given series Reviewed by admin on December 24, 2019 Rating: 5

No comments:

Powered by Blogger.