Fibonacci Sequence — Set 2 Program No.2

December 12, 2008 at 14:51 (Uncategorized)

/**
* @(#)fibonacci.java
* Program Number 2 >> Set 2
* Submitted by Neil John C. Basan
* Submitted to Mr. Rico E. Nonles
* 12.11.08
*/
import java.io.*;
class fibonacci
{
public static void main (String[] args) throws IOException
{
int nput, i, fibo1, fibo2, fibo3;
BufferedReader inputFromtheUser = new BufferedReader (new InputStreamReader (System.in));
String element = new String();
do
{
fibo1 = 0;
fibo2 = 1;
fibo3 = 1;

System.out.print(“Enter an Integer: “);
nput = Integer.parseInt(inputFromtheUser.readLine());

if (nput45) // prohibits the user from inputting less than 2
System.out.print(“Input must be above 2 and below 46″);
else if (nput==2)
System.out.print(” “+fibo2+” “+fibo3);
else
{
System.out.print(” “+fibo2+” “+fibo3);
for(i=3; i<=nput;i++) // loop until the user input
{ fibo1 = fibo2 + fibo3; //add the two numbers following the first fibonacci
System.out.print(” “+fibo1);
fibo3 = fibo2; //update the next fibonacci sequence to next number
fibo2 = fibo1; //update the next fibonacci sequence to previous number
}
}
System.out.print(“\nWould you like to perform a test? (y/n): “);
String firstAnswer = inputFromtheUser.readLine();
// —————————————————————-
// firstAnswer is NOT equal to “yes” and NOT equal to “y”,
// so we exit the program.
// —————————————————————-
if( ! firstAnswer.equalsIgnoreCase(“yes”) && ! firstAnswer.equalsIgnoreCase(“y”))
break;
}while(true);
}
}

Permalink Leave a Comment

Visual Basic 6.0 Tutorial

December 11, 2008 at 16:59 (Uncategorized)

http://people.revoledu.com/kardi/

http://en.allexperts.com/q/Visual-Basic-1048/

http://www.599cd.com/tips?key=AllExperts

Permalink Leave a Comment

Do While Loop with Yes or No in Java

December 11, 2008 at 12:49 (Uncategorized)

String element = new String();
do{
System.out.print(“\nWould you like to perform a test? (y/n): “);
String firstAnswer = inputFromtheUser.readLine();
// —————————————————————-
// firstAnswer is NOT equal to “yes” and NOT equal to “y”,
// so we exit the program.
// —————————————————————-
if( ! firstAnswer.equalsIgnoreCase(“yes”) &&
! firstAnswer.equalsIgnoreCase(“y”))
break;

}while(true);

Source: i cannot remember where i get these codes but im certain that i found it in google.com// the code is BinarySearch.java. Give credits to him/her when you use these codes. thx alot.

Permalink Leave a Comment

Physics – 2 Activity No 3

December 10, 2008 at 15:05 (Uncategorized)

Download:
Physics – 2 Activity No 3 link

Permalink Leave a Comment

Follow

Get every new post delivered to your Inbox.