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 |
What are the types of data files?
How can I call a function with an argument list built up at run time?
a 'c' program to tell that the set of three coordinates lie on a same line
write a program in C to swap two variables
What is union and structure in c?
What happens if you free a pointer twice?
print ur name without using any semicolon in c/c++....
21 Answers Bosch, TCS, Wipro,
sqrt(x+sqrt(x+sqrt(x+sqrt(x))))=2; Find the value of x?
What is atoi and atof in c?
52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
How to find the digits truncation when assigning the interger variable to the character variables. like int i=500; char x = i : here we have truncation. how to find this. another ex: i =100; char x=i. here we do not have truncation.
How to add two numbers with using function?