Hyderabad Local Train Timings   Andhra Tourist Spots   Telangana Issue - SriKrishna Committee   APPSC Exams Online Guide   
AndhraSpider.com
 
 


ForumResourcesTolly UpdatesEntrance ExamsQuestion Bank



My Profile


Active Members
Today
    Last 7 Daysmore...



    Resources » Education » Andhra Pradesh school/colleges/university news


    JNTU Hyderabad CSE/IT Java OOPS Week 1B - To find the numbers of Fibonacci series


    Posted Date:     Category: Andhra Pradesh school/colleges/university news    Rating: 2 out of 52 out of 5
    Author: Member Level: Gold    Points: 5 (Rs 2)


    Are you looking for JNTU Hyderabad CSE/IT solved java 2-2 lab assignments and week programs ? Here is the perfect resource for you . You can directly copy and paste the below code in a Java Editor to excecute the program.


    Get the solutions for JNTU Btech Lab java programs for CSE and Information Technology branches . The resource includes the clear explanation of the code. The below code was uploaded only after the successful execution using Java Standard Edition. JNTU Hyderabad and affiliated colleges conducts a lab session every week for all B.tech Regular students. Here I'm giving solution for the Week 1 2nd program. The aim of the program is to generate the fibonacci series using a simple java program .You can also get more information about JNTU Java programs solutions on this site for all weeks.
    Input: The value of n is given as input.
    Fibonacci series:
    0,1,1,2,3,5,8,13,21,34...
    where f(0)=0,f(1)=1,f(n)=f(n-1)+f(n-2)
    ie the third no in series=0+1=1, fourth number =1+1=2,fifth number=1+2=3
    This can be solved in java by implementing the following source code. With this, you have successfully completed the week 1 second program of your Jntu CSE/IT 2-2 Syllabus.

    //The below program is used to generate the nth number in the fibonacci series
    class Fibonacci //define class
    {
    public static int Fib(int n)//the function taking n as parameter
    {
    if(n>2)
    return (Fib(n-1)+Fib(n-2));//the formula for all n>2
    else
    return 1;//if n=1 => f=1
    }
    {
    public static void main(String[] args)

    int n=Integer.parseInt(args[0]);//The first argument is read as 'n'
    int val=Fib(n);//The fibonacci no. is stored in 'val'
    System.out.println("The "+n+"th"+" value in the series is "+val);//Display the fibonacci no.
    }
    }
    The out put of the program will be as follows:

    Output:
    save the above file as Fibonac.java in a note pad.
    Press the start button, click on run.
    Enter cmd and click enter.
    Now type d: and click enter
    type cd education and press enter
    type cd java and press enter
    Excecute it.
    D:\education\java>javac Fibonac.java
    D:\education\java>java Fibonac 10
    The 10 th value in the series is 55


    Did you like this resource? Share it with your friends and show your love!




    Related Resources:


    Read related articles: JNTU lab assignments    JNTU Hyderabad    


    Responses to "JNTU Hyderabad CSE/IT Java OOPS Week 1B - To find the numbers of Fibonacci series"

    No responses found. Be the first to respond...

    Feedbacks      

    Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: JNTU Hyderabad CSE/IT Java OOPS Week 1A - Finding the roots of a quadratic equation
    Previous Resource: JNTU Hyderabad CSE/IT Java OOPS Week 2A - To find the prime numbers below 'n'
    Return to Resources
    Post New Resource
    Category: Andhra Pradesh school/colleges/university news


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Jntu Hyderabad  .  Week programs  .  Java programs  .  Lab programs  .  Jntu week programs  .  

    Subscribe to Email
  • Get Jobs by Email
  • Forum posts by Email
  • Articles by Email

  • Skilled Writer?

    Part time content writers wanted for several websites to work online from home.
    Skills: Excellent English writing skills. Good English skills with basic computing knowledge needed. Visit the link below for more details

    Online Content Writing Jobs

    Online membersMore...


    Areas
  • Adilabad
  • Anantapur
  • Chittoor
  • Cuddapah
  • East Godavari
  • Guntur
  • Hyderabad
  • Karim Nagar
  • Khammam
  • Krishna
  • Kurnool
  • Mahabub Nagar
  • Medak
  • Nalgonda
  • Nellore
  • Nizamabad
  • Prakasam
  • Ranga Reddy
  • Rangareddy
  • Srikakulam
  • Visakhapatnam
  • Vizianagaram
  • Warangal
  • West Godavari

  • Awards & Gifts



    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2011 All Rights Reserved.