java program code

java program code

can any one write a program (class) which will have two methods Fibonacci and Factorial, which will be a void and a return respectively. i will be glad if it can have a good display results

View Answers

May 11, 2011 at 3:15 PM

class FindFibonacciAndFactorial 
{
    public static void fibonacciSeries(){
    int f1=0,f2=0,f3=1;
    for(int i=1;i<=5;i++){
        System.out.println(f3);
        f1=f2;
        f2=f3;
        f3=f1+f2;
    }
    }
    public static int findFactorial(int n)
    {
        if (n == 1) {
            return n;
        }
        else {
            return n * findFactorial(n-1);
        }
    }
    public static void main(String[] args) 
    {
    fibonacciSeries();
    System.out.println(findFactorial(5));
    }
}

May 11, 2011 at 5:19 PM

the program has to display user input and if any has to show any arror message thank atherwise for the information you give me big thanks.









Related Tutorials/Questions & Answers:
java program code
java program code  can any one write a program (class) which will have two methods Fibonacci and Factorial, which will be a void and a return respectively. i will be glad if it can have a good display results
program code - Java Beginners
program code  Design and write a Java application that takes as input... to either Q or Z. For the two letters, your application should display a message..., This code will be helpful to you in solving your problem. import java.util.
Advertisements
core java code for following program
core java code for following program  We are hosting the Olympic games. Write a program that will track all the details of this hosting. The program should track the countries and their players along with the games
source code program - Java Beginners
source code program  I need the source code for a program that converts temperatures from celsius to fahrenheit and vice versa, as well as converting kilometers to miles and vice versa using Java "classes".  Hi
program code for this question - Java Beginners
program code for this question  QUESTION 2: Address Information..., are kept in a file. Your task: Write a Java application LookUp.java that acts as an IP lookup tool. The program reads a search phrase (which could either be an IP
Small program code - Java Beginners
Small program code  Develop the echo server and the echo client program that display whatever is typed in the server on to the client
program code for this question - Java Beginners
program code for this question  QUESTION 1: Electricity Bill Tshubang...: Write a Java application, ProduceBills.java, that reads the name of the file.... Program should send each customer?s bill to a text file whose name is the customers?s
inheritance code program - Java Beginners
inheritance code program  class Point { private int x ; private int y; public Point (int x , int y) { this.x = x; this.y =y...: http://www.roseindia.net/java/master-java/interface.shtml Thanks. Amardeep
code for program
code for program  hello,I am new to java and need to get the code for a program,i've been trying all sorts of code and nothing works any help would be appreciated.Below is what the program should output with the user's input
code for a program
code for a program   Write a program which has 2 numbers. There should be an option to add, multiply, divide and subtract these numbers a. If user opts "A" - Add the 2 numbers b. If user opts "S" - Subtract the numbers c
program code
program code  I need to get the code for the following,the user's input are enclosed in curly brackets,thank you. HARDWARE ITEMS CODE DESCRIPTION... 23} ADDRESS-2: {Building 8} ADDRESS-3: {Winchester} POST CODE: {89763} ENTER
program code
program code  I want a program that accepts a word from TextField and check with multiple .csv file and displays the snippets from csv file into TextArea. Please help me
program code
program code  login and registration form for shopping cart using struts-hibernate with oracle database connection
Program to find no of metrics in a file ----- Java code
Program to find no of metrics in a file ----- Java code  Hi Friends, I got a task to calculate the metrics of a program, like to find the no of SELECT and INSERT statement is a program. With that I have to even calculate
jdbc connection to java program code - JDBC
jdbc connection to java program code  i want a simple java program that which communicates with oracle database like creating table,insert values and update records in database and show in program output? please take a simple
doubt in my program code - Java Beginners
doubt in my program code  i have developed a web browser with the help of standard widget toolkit(swt) and java. i creted some buttons such as GO... the code i developed i can send u to ur mail if u give ur mail id
Please write code for this program in java and Explain it ? pl'sssssssss
Please write code for this program in java and Explain it ? pl'sssssssss ... findmaxdinosaur (int[] years); Java : public int findMaxdinosaur (int[] years);    wow i got also same program. ok leave it. in this program they are passing
program code - Java Server Faces Questions
program code  hai i am meyis i need a jsp program code for date generation.(mssql-back end) Fields are fromdate and todate both field are datetime..., Plz explain the below code line with source code to solve the problem. "how
Please provide the java code for the given program.
Please provide the java code for the given program.   We need an application for managing an educational institute. That application should provide...: StudentAddr: StudentDob: Email: Course ALL Java C C++ Oracle Fees: Duration: Faculty
i need program or code for this program
i need program or code for this program  out should be in this form 1 2 3 4 5 6 3 5 7 9 11 8 12 16 20 20 28 36 48 64 112
program code - JSP-Servlet
program code  what is the program code for LOGINFORM USING SERVLETS? RESPOND SOON
program code - JSP-Servlet
program code  what is the program code for LOGINFORM USING SERVLETS? RESPOND SOON
applet program code - Applet
applet program code  hello sir, i did't get the code for below problem... please help me... 1.An applet program to draw a line graph for y=2x+5.[for suitable values of x & y
full description of program code
(consonants)); } } above a program code of reverse string program in this program...full description of program code  import java.util.*; class.... i've a problem that plz describe me full description of this code thanks
full description of program code
(consonants)); } } Describe me in deeply full detail of above program code how is make. this program output is like this Enter string: the purpose of empty area...full description of program code  import java.util.*; class
decription of program code
decription of program code  Describe me below code how this program code is make and work, and those method is use in this why? import java.util.*; class SortList { public static void main(String[]args) { Scanner input=new
full description of program code
full description of program code  escribe me below code how this program code is make and work, and those method is use in this why? import java.util.*; class SortList { public static void main(String[]args) { Scanner input=new
source code in java for a program using class - Java Beginners
source code in java for a program using class  Dear sir/madam i want source code in java for following program: WAP which creates a class accountthat stores customer name,account number and type of account.From this derive
Pleae help me to give logic and code for this program - Java Beginners
Pleae help me to give logic and code for this program  Write a function that given the string ?original? create a new string ?dramatic? that has two...://www.roseindia.net/java/beginners/StringReverseUsingStringUtils.shtml
code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........
code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........  code for a simple java program which performs basic arithmetic operation addition,subtraction
How to open a window from a java program (from code)[ (onclick of something text )]
How to open a window from a java program (from code)[ (onclick of something text )]  When I download the code an put it in Eclipse, the applet is run, but on click of the button displayed in the applet, a new window with google
program code for login page in struts by using eclipse
program code for login page in struts by using eclipse  I want program code for login page in struts by using eclipse
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
thread is a sequential path of code execution within a program.
thread is a sequential path of code execution within a program.   thread is a sequential path of code execution within a program. what is the meaning if sequential path of code execution? please explain me
Plz Provide correct program code for all questions.
Plz Provide correct program code for all questions.   Write a program... of n numbers? Develop a program that accepts the area of a square and will calculate its perimeter. Develop the program calculateCylinderVolume., which accepts
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
java program for
java program for   java program for printing documents,images and cards
java program
java program  i want a applet program that accepts two input strings using tag and concatenate the strings and display it in status window. please give mi he code for this in core java
java program
java program  i want a applet program that accepts two input strings using tag and concatenate the strings and display it in status window. please give mi he code for this in core java
java program
java program  i want a applet program that accepts two input strings using tag and concatenate the strings and display it in status window. please give mi he code for this in core java
a Java program
a Java program    Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number
Java Program
Java Program  A Java Program that print the data on the printer but buttons not to be printed

Ads