answersLogoWhite

0


Best Answer

<script type = "text/javascript">

var input;

var rev = 0;

input=window.prompt ("Please enter a 5-digit number to be reversed.");

input = input * 1;

while (input > 0)

{

rev *= 10;

rev += input % 10;

input /= 10;

}

document.write ("Reversed number: " + rev);

</script>

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java script program to Print the Fibonacci series using array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a program to print the Fibonacci series in php upto input value using recursive function?

The Fibonacci sequence uses recursion to derive answers. It is defined as: F0 = 0 F1 = 1 Fn = F(n - 1) + F(n -2) To have this sequence printed by a php script use the following: function fibonacci($n) { if($n 1) return 1; //F1 else return fibonacci($n - 1) + fibonacci($n - 2); //Fn } This recursive function will print out the Fibonacci number for the integer n. To make it print out all the numbers in a particular set add this to your script. for($i = 0; $i &lt; 15; $i++) { echo fibonacci($i) . "&lt;br /&gt;"; } So your final result would look like. &lt;?php function fibonacci($n) { if($n 1) return 1; else return fibonacci($n - 1) + fibonacci($n - 2); } for($i = 0; $i &lt; 15; $i++) { echo fibonacci($i) . "&lt;br /&gt;"; } ?&gt;


Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


What is the program to print Fibonacci series in qbasic?

CLS a = 0 b = 0 FOR i = 1 TO 10 IF a = 0 THEN f = 1 END IF PRINT f b = a a = f f = a + b NEXT i END from : Parth jani parthjani7@yahoo.com


Write a C program to print the following series 112 122 . 1n2?

write a program to print the series 1/12+1/22+.........+1/n2 ?


How do you write a program to print Fibonacci series of n numbers using recursion in cpp?

#include&lt;iostream&gt; unsigned fib (unsigned term, unsigned a=0, unsigned b=1) { if (term&lt;1) return a; return fib (--term, a+b, a); } int main() { std::cout &lt;&lt; "Fibonacci (1000th term): " &lt;&lt; fib (1000) &lt;&lt; std::endl; }

Related questions

Write a program to print the Fibonacci series in php upto input value using recursive function?

The Fibonacci sequence uses recursion to derive answers. It is defined as: F0 = 0 F1 = 1 Fn = F(n - 1) + F(n -2) To have this sequence printed by a php script use the following: function fibonacci($n) { if($n 1) return 1; //F1 else return fibonacci($n - 1) + fibonacci($n - 2); //Fn } This recursive function will print out the Fibonacci number for the integer n. To make it print out all the numbers in a particular set add this to your script. for($i = 0; $i &lt; 15; $i++) { echo fibonacci($i) . "&lt;br /&gt;"; } So your final result would look like. &lt;?php function fibonacci($n) { if($n 1) return 1; else return fibonacci($n - 1) + fibonacci($n - 2); } for($i = 0; $i &lt; 15; $i++) { echo fibonacci($i) . "&lt;br /&gt;"; } ?&gt;


Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


What is the program to print Fibonacci series in qbasic?

CLS a = 0 b = 0 FOR i = 1 TO 10 IF a = 0 THEN f = 1 END IF PRINT f b = a a = f f = a + b NEXT i END from : Parth jani parthjani7@yahoo.com


Write a C program to print the following series 112 122 . 1n2?

write a program to print the series 1/12+1/22+.........+1/n2 ?


You want python program to find fibbonaci series?

The Fibonacci series is a sequence of numbers, with the first two defined as 0 and 1, and all following numbers defined as the sum of the two previous numbers. The following python program asks a user how many Fibonacci numbers they want calculated, then calculates them. NOTE: This site removes formatting from answers. Replace (tab) with a tab, or four spaces. #!/usr/bin/python print("This program finds Fibonacci numbers.") answer = "y" while answer == "y": (tab)print("How many terms would you like?") (tab)n = int(input(": ")) (tab)a = 0 (tab)b = 1 (tab)for i in range(0,n): (tab)(tab)print(str(a) +",") (tab)(tab)c = a + b (tab)(tab)a = b (tab)(tab)b = c (tab)print("Would you like to run again? (y/n)") (tab)answer = input(": ")


Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.


How do you write a program to print Fibonacci series of n numbers using recursion in cpp?

#include&lt;iostream&gt; unsigned fib (unsigned term, unsigned a=0, unsigned b=1) { if (term&lt;1) return a; return fib (--term, a+b, a); } int main() { std::cout &lt;&lt; "Fibonacci (1000th term): " &lt;&lt; fib (1000) &lt;&lt; std::endl; }


Write a JavaScript program to print first ten odd natural numbers?

&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function series() { var i=1 while(i&lt;=10) { document.write(i+"&lt;br&gt;") i=i+2 } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="#" name=f1&gt; &lt;input type=button value="generate series" onclick="series()"&gt; &lt;/form&gt; &lt;br&gt;&lt;span id="outtab"&gt;&lt;/span&gt; &lt;/body&gt; &lt;/html&gt;


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).


How do you call a perl program from javascript?

You can call the Script like this, &lt;script type="text/javascript" src="perl_script.pl"&gt;&lt;/script&gt; So you just replace a regular Javascript Call ( .js ) with the .pl Script. Inside the Perl Script you will have to use embraced Javascript Functions / Code, f.e. like print "document.write.('Hello World');";.


Write a C program Fibonacci using normal loops and conditional statements?

to print the Fibonacci series until 100 you can take the input in d to make it run for whatever value you want void main(){ int a,b,c,d; a=0; b=1; c=1; d=100; while(c&lt;d) { printf("%d\n",c); c=a+b; a=b; b=c; } }


Write a shell program to generate fibnacci series using while loop?

//WAP to print fibonacci series using do-while loop.? using System; class Fibonacci { public static void Main() { int a=1,b=1; int sum=0; Console.Write("Enter Limit:"); int n=Int32.Parse(Console.ReadLine()); Console.Write(a); Console.Write(b); do { sum=a+b; a=b; b=sum; Console.Write(sum); } while(sum&lt;n); } } By-Vivek Kumar Keshari