answersLogoWhite

0

void main()

{

int n,old=0,curr=1,new=0;

clrscr();

printf("enter the total number of terms up to which you want to print the Fibonacci series");

scanf("%d",&n);

printf("%d",old);

printf("\n%d",curr);

for(i=1;i<=n;i++)

{

new=old+curr;

old=curr;

curr=new;

printf("\n%d",new);

}

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

How do you write a c program to calculate the Fibonacci series of a given number?

To write a C program that calculates the Fibonacci series up to a given number, you can use a loop to generate the series. Start by initializing the first two Fibonacci numbers (0 and 1) and then repeatedly compute the next number by adding the two preceding numbers until you reach or exceed the specified limit. Here’s a simple example: #include &lt;stdio.h&gt; int main() { int n, t1 = 0, t2 = 1, nextTerm; printf(&quot;Enter a positive integer: &quot;); scanf(&quot;%d&quot;, &amp;n); printf(&quot;Fibonacci Series: %d, %d&quot;, t1, t2); for (int i = 3; i &lt;= n; ++i) { nextTerm = t1 + t2; printf(&quot;, %d&quot;, nextTerm); t1 = t2; t2 = nextTerm; } return 0; } This program prompts the user for a number and prints the Fibonacci series up to that number.


Can you explain the program of Fibonacci series in c?

You mean you have written a program, but you don't understand it? Well, how could I explain it without seeing it?


Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


How do you write a program to print Fibonacci series of n numbers using recursion in cpp?

#include&lt;iostream&gt; unsigned fib (unsigned term, unsigned a=0, unsigned b=1) { if (term&lt;1) return a; return fib (--term, a+b, a); } int main() { std::cout &lt;&lt; "Fibonacci (1000th term): " &lt;&lt; fib (1000) &lt;&lt; std::endl; }


Do Fibonacci Series program in dot net?

public static int fib(int n) {return fib(n-1) + fib(n-2);}

Related Questions

How you can predict lotto numbers by Fibonacci series?

randomly


What is Fibonacci number series?

A Fibonacci number series is like the example below, 1,1,2,3,5,8,13,21,34,55,89,144,233,377,610...... and so on in general Fibonacci numbers are just the previous two numbers added together starting with 1 and 0 then goes on forever.


What is the next number in the Fibonacci series?

The sum of the previous two numbers in the series.


What is 37 as the sum of Fibonacci numbers?

37 is not in the Fibonacci number series, but is the sum of two Fibonacci numbers, 34 and 3. Fibonacci numbers are with 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc.


What does Fibonacci mean in maths?

The Fibonacci sequence is a series of numbers That was discovered by an Italian mathematician called Leonardo Pisano. Sequences are a patter of numbers.


What is a Fibonacci Numbers?

The Fibonacci numbers is a series of numbers that are found in nature and other things. The series goes 0,1,1,2,3,5,8,13,21 and so on. You just add the last two numbers in the series. 0+1=1, 1+1=2, 2+1=3, and so on.


Are the Fibonacci sequence and the Fibonacci triangle the same thing?

No, the Fibonacci sequence and the Fibonacci triangle are not the same thing. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, typically starting with 0 and 1. In contrast, the Fibonacci triangle, also known as the Fibonacci triangle or triangle of Fibonacci numbers, is a triangular arrangement of numbers that represents combinations of Fibonacci numbers, often related to combinatorial properties. While both concepts are related to Fibonacci numbers, they have different structures and applications.


What is the sub set of Fibonacci primes?

Fibonacci primes are Fibonacci numbers that are also prime numbers. The Fibonacci sequence, defined as F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n ≥ 2, produces a series of numbers. Among these, the Fibonacci primes include numbers like 2, 3, 5, 13, and 89, which are prime and appear within the Fibonacci sequence. Not all Fibonacci numbers are prime, making Fibonacci primes a specific subset of both prime numbers and Fibonacci numbers.


How do you write a c program to calculate the Fibonacci series of a given number?

To write a C program that calculates the Fibonacci series up to a given number, you can use a loop to generate the series. Start by initializing the first two Fibonacci numbers (0 and 1) and then repeatedly compute the next number by adding the two preceding numbers until you reach or exceed the specified limit. Here’s a simple example: #include &lt;stdio.h&gt; int main() { int n, t1 = 0, t2 = 1, nextTerm; printf(&quot;Enter a positive integer: &quot;); scanf(&quot;%d&quot;, &amp;n); printf(&quot;Fibonacci Series: %d, %d&quot;, t1, t2); for (int i = 3; i &lt;= n; ++i) { nextTerm = t1 + t2; printf(&quot;, %d&quot;, nextTerm); t1 = t2; t2 = nextTerm; } return 0; } This program prompts the user for a number and prints the Fibonacci series up to that number.


What is is a Fibonacci number?

The Fibonacci numbers is a series of numbers that are found in nature and other things. The series goes 0,1,1,2,3,5,8,13,21 and so on. You just add the last two numbers in the series. 0+1=1, 1+1=2, 2+1=3, and so on.


What is the upper bound of the sum of the elements in the Fibonacci sequence?

There is no upper bound to the sum of the numbers in the Fibonacci sequence; both the last number in the series and consequently the sum of all these numbers can be made as large as desired by continuing the series to sufficiently many numbers.


Write a c program Fibonacci series using for loop in java?

Exactly what do you mean by 'C program in Java'