import java.io.*;
public class fibonacci
{
public static void main(String args[]) throws IOException
{
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(read);
int a=0, b=1;
int c;
for(int i=0;i<11;i++)
{ c=a+b;
System.out.println(c);
a=b;
b=c;
}
}
}
Tuesday, March 23, 2010
Fibonacci
Subscribe to:
Post Comments (Atom)
This comment has been removed by the author.
ReplyDeleteclass Fibonacci
ReplyDelete{public static void main(String args[])
{
int a=0,b=1,c=0,i;
System.out.print(a+","+b+",");
for(i=3;i<=11;i++)
{
c=a+b;
if(i==11)
System.out.print(c);
else
System.out.print(c+",");
a=b;
b=c;
}
}
}
la gopi
Deleteto display first 30 terms of the fibonacci series in an array and display the ones which are prime.use a function that checks whether a number is prime or not
ReplyDeleteIt's not right
ReplyDelete