Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class test
- {
- public static void printFibo(int n)
- {
- int a[]=new int[2];
- a[0]=a[1]=1;
- int i=2;
- for(;i<n;i++)
- {
- a[i%2]=a[0]+a[1];
- }
- System.out.print(a[(i-1)%2]);
- }
- public static void main(String arg[])
- {
- printFibo(3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement