Welcome!



I'm Alexander Rahardjo. Here is some tutorials with its algorithms and source codes for solving some programming problem with some programming languages. Check this out and enjoy to learn programming with this site. For question you can ask by the "Visitors" box..Thanks






There is a program for Fibonacci Number normal and abnormal


/*Fibonacci Number
author http://www.programming-codes.co.cc*/

import java.util.*;
class Fibonacci{
public static void main(String args[]){
int a,b,c,input;
Scanner read = new Scanner(System.in);
a=0;
b=1;
c=1;
System.out.print(" *Program Fibonacci Normal dan Tak Normal*\n\n");
System.out.print("Masukkan banyaknya deret fibonacci= ");
input = read.nextInt();
System.out.print("Deret Fibonacci Normal= ");
for(int i=1;i<=input;i++){
System.out.print(c+" ");
c = a+b;
a = b;
b = c;
}
a=0;
b=1;
c=1;
System.out.print("\nDeret Fibonacci Tak Normal= ");
for(int i=1;i<=input;i++){
if (i % 2 == 0)
{
c=c*(-1);
}
else
{
c=c*1;
}
System.out.print(c+" ");
c = a+b;
a = b;
b = c;
}
System.out.println();
}
}



Download the code here

Posted in Label: , , Diposting oleh Alexander Rahardjo  

0 komentar:

 



Copyright 2005-2007. Hello Wiki designed by Fen, Blogger Templates by Blogcrowds
Last Edited by PhOeNiXxX ™
.