coding for Fibonacci.?
Answer / siggi
class hcl
{
public static void main(String arg[])
{int a=0;
int b=1;
int i=1;
int x,y;
/*System.out.println("enter the no.");*/
x=Integer.parseInt(arg[0]);
if(x==0 || x==1)
{ System.out.println("yes it is");}
else {
do
{
y=a+b;
if(x==y)
{ System.out.println("yes it is");
i=0;}
else if(x>y)
{a=b;
b=y;}
else
{ i=0;
System.out.println("no it is not");}
}while(i!=0);
}
}
}
| Is This Answer Correct ? | 1 Yes | 3 No |
To find whether a number is even or odd without using any conditional operator??
12 Answers College School Exams Tests, IBM,
How can you determine the size of an allocated portion of memory?
Find MAXIMUM of three distinct integers using a single C statement
How can you increase the allowable number of simultaneously open files?
Explain continue keyword in c
What are the different data types in C?
What is a pointer variable in c language?
how to add two numbers without using arithmetic operators?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
Why pointers are used?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Eight queens puzzle