Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop

  • Career & Tech HQ
  • 2020-08-10
  • 3352
Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop
fibonacci seriesfibonacci series in javafibonacci series in java using recursionfibonacci series in c using recursionjava programming projectscore java interview questionsjava programming tutorialjava programming languagejava programming tutorial for beginnersjava programmingcore java tutorialdata structures and algorithmsjava tutorial for beginners eclipsefibonacci series algorithmdata structures and algorithms in javadata structures in calgorithm
  • ok logo

Скачать Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop

Find nth Fibonacci number Algorithm in Java with a PRACTICAL EXAMPLE using while loop

In this video, we are going to write a program that uses a while loop to find a Fibonacci number by specifying its position in the Fibonacci sequence
In Mathematics, Fibonacci numbers form a sequence of numbers called the Fibonacci sequence
By definition, the Fibonacci sequence is a series of numbers where each number is the addition of the last two preceding numbers starting with 0 and 1

Here on the screen is an example of that sequence

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ....

In this sequence, for example, you can notice that 34 is the result of the addition between the preceding numbers which are 21 and 13
Or 21 is the result of the addition between 13 and 8
13 is the result of the addition between 5 and 8
8 is the result of the addition between 3 and 5

From the sequence on the screen
You can determine the next Fibonacci number by applying the same logic
Which is to add up 21 and 34 in order to get 55

As I said at the beginning, in this video we are going to develop a program that will allow us to find the Fibonacci number that occupies a specific position in the sequence

The program must allow the user to input the position of the desired Fibonacci number in the Fibonacci sequence

That simply means that we need to get the first two Fibonacci numbers, the position of the desired number in the Fibonacci sequence
Then calculate the next Fibonacci number by adding the previous two elements of the Fibonacci sequence
And repeat this step until the desired Fibonacci number is found
Then print out that Fibonacci number

Here is how the code will look like

First, let’s declare the input object like this
Static Scanner console = new Scanner(System.in)

Second, let’s declare the various variables used in the program
The first variables will be the ones to store the first two numbers of the Fibonacci sequence
int number1 = 0
Int number2 = 1;

The next variable will be the one that stores the desired Fibonacci number
int fibonacci_number;

I will need another variable that will store the position of the Fibonacci number we are looking for
int number_position;

Then, the other variable will be the loop control variable
int counter;

Now, let’s write the output statements
The first output statement will tell the user about the first and second Fibonacci number of the sequence
System.out.println(“The first two numbers of the Fibonacci sequence are “ + number1 + “ and “ + number2);
The second statement will prompt the user to enter the position of the desired Fibonacci number
System.out.println(Please enter the position of the Fibonacci number you desire to see);

Right after that, let’s add an input statement to allow the user to enter the position
number_position = console.nextInt();

We have now reached the main part of our program
Which is to determine how the program will find the desired Fibonacci number

Let’s start by writing an if … else selection control structure
In which the Fibonacci number position entered by the user will be used in the condition

if (number_position == 1) {
fibonacci_number = number1;
}
else if (number_position == 2) {
fibonacci_number = number2;
}
else {

Else if the position entered by the user is actually greater than 2 then
We will initialize the counter variable and set it to 3
counter = 3;

After we need a while loop
And in the condition of the while loop we will test and compare the variable counter and the variable number_position

while ( counter less than or equal number_position ) {

In the body of the loop here are the action statements that need to execute
fibonacci_number = number 2 + number1;

This is because the Fibonacci number is the addition between the last two preceding numbers of the sequence

Also, in order to make sure that the Fibonacci number sequence will continue, we need to add these other statements
number1 = number2;
number2 = fibonacci_number;
counter++;
}
}

Outside of the while loop and the if statement
Let’s write the output statement that will print out the desired Fibonacci number
System.out.println(“The desired “ + number_position + “th Fibonacci number is : “ + fibonacci_number);

}
}

Once everything is set up correctly
You can run the program and see what happens

Thanks for viewing, I hope this video was informative.
Please do not forget to like and SUBSCRIBE to this channel.
Let’s meet in the next video.


#codingriver
#fibonaccialgorithm
#learnjava

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]