Автор Sdfsdf ... задал вопрос в разделе Другие языки и технологии
информатика паскаль. и получил лучший ответ
Ответ от -Egor-[гуру]
есть рекурентный алгоритм для чисел фибоначи .Поищи в wikipedia.org там есть пример на паскале
Ответ от Їак Норрис[гуру]
НОД оне же GDC (Greatest common divisor)
{Greatest common divisor}
Program GCD;
Var
x, y : Integer;
begin
read(x);
While x <> 0 do
begin
read(y);
While x <> y do
if x > y then
x := x - y
else
y := y - x;
Write(x);
read(x);
end;
end.
Фибоначчи
{
>The problem is to Write a recursive Program to calculate Fibonacci numbers.
>The rules For the Fibonacci numbers are:
>
> The Nth Fib number is:
>
> 1 if N = 1 or 2
> The sum of the previous two numbers in the series if N > 2
> N must always be > 0.
}
Function fib(n : LongInt) : LongInt;
begin
if n < 2 then
fib := n
else
fib := fib(n - 1) + fib(n - 2);
end;
Var
Count : Integer;
begin
Writeln('Fib: ');
For Count := 1 to 15 do
Write(Fib(Count),', ');
end.
НОД оне же GDC (Greatest common divisor)
{Greatest common divisor}
Program GCD;
Var
x, y : Integer;
begin
read(x);
While x <> 0 do
begin
read(y);
While x <> y do
if x > y then
x := x - y
else
y := y - x;
Write(x);
read(x);
end;
end.
Фибоначчи
{
>The problem is to Write a recursive Program to calculate Fibonacci numbers.
>The rules For the Fibonacci numbers are:
>
> The Nth Fib number is:
>
> 1 if N = 1 or 2
> The sum of the previous two numbers in the series if N > 2
> N must always be > 0.
}
Function fib(n : LongInt) : LongInt;
begin
if n < 2 then
fib := n
else
fib := fib(n - 1) + fib(n - 2);
end;
Var
Count : Integer;
begin
Writeln('Fib: ');
For Count := 1 to 15 do
Write(Fib(Count),', ');
end.
Ответ от 22 ответа[гуру]
Привет! Вот подборка тем с похожими вопросами и ответами на Ваш вопрос: информатика паскаль.