Guys Pls Help me out of this.
How to check whether the input is fibonacci or not? This is node.js
var n=5,s,a,fib;
function isPerfectSquare(s){var a=Math.sqrt(s);return (a*a == s);}
function isFibonacci(n){
s=(5*Math.pow(n,2)+4 || 5*Math.pow(n,2)-4)return s;}
//How to fix this line. I don't know how to check perfect square conditions
if(isPerfectSquare(isFibonacci(n)) || isPerfectSquare(isFibonacci(n)))
{
fib=Math.round(n* 1.618); // finds the next fibonacci series of given input
console.log("The next Fibonacci number is " + fib);}
else{
console.log("The given number is not a fibonacci number");}
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.