Question

A particular series will be given such as the Fibonacci series which is defined as follows;...

A particular series will be given such as the Fibonacci series which is defined as follows; 1, 1, 2, 3, 5, 8,….. Generate the Fibonacci series for a user given finite number of terms. Print out the series in the following triangular form (Pascal form). In c Programming.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  1. #include<stdio.h>    
  2. #include<stdlib.h>  
  3. int main(){  
  4.    int a=0,b=1,i,c,n,j;    
  5. system("cls");  
  6.     printf("Enter the limit:");    
  7.     scanf("%d",&n);    
  8.     for(i=1;i<=n;i++)    
  9.     {    
  10.         a=0;    
  11.         b=1;    
  12.         printf("%d\t",b);    
  13.         for(j=1;j<i;j++)    
  14.         {    
  15.             c=a+b;    
  16.             printf("%d\t",c);    
  17.             a=b;    
  18.             b=c;    
  19.     
  20.         }    
  21.         printf("\n");    
  22.     }    
  23. return 0;  
  24. }  
  25. Output:
  26. Enter the limit:9
    1
    1       1       
    1       1       2       
    1       1       2       3       
    1       1       2       3       5       
    1       1       2       3       5       8       
    1       1       2       3       5       8       13      
    1       1       2       3       5       8       13      21      
    1       1       2       3       5       8       13      21      34      
    
    Enter the limit:5
    1
    1       1       
    1       1       2       
    1       1       2       3       
    1       1       2       3       5       
Add a comment
Know the answer?
Add Answer to:
A particular series will be given such as the Fibonacci series which is defined as follows;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In mathematics, the Fibonacci numbers are the series of number that exhibit the following pattern: 0,1,1,2,3,5,8,13,21,34,55,89,144,.......

    In mathematics, the Fibonacci numbers are the series of number that exhibit the following pattern: 0,1,1,2,3,5,8,13,21,34,55,89,144,.... In mathematical notation the sequence Fn of Fibonacci number is defined by the following recurrence relation: Fn=Fn-1+Fn-2 With the initial values of F0=0 and F1=1. Thus, the next number in the series is the sum of the previous two numbers. Write a program that asks the user for a positive integer N and generate the Nth Fibonacci number. Your main function should handle user...

  • c++ fibonacci code using loops Here are 8 Fibonacci numbers: 1, 1, 2, 3, 5, 8,...

    c++ fibonacci code using loops Here are 8 Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13, 21 Note that the first Fibonacci number is 1, F(1) = 1 The second Fibonacci number is 1, i.e. F(2) = 1 Other Fibonacci numbers in the sequence is the sum of two previous Fibonacci numbers. For example F(3) = F(2) + F(1). In general F(n) = F(n-1) + F(n-2) Write a program to do the following tasks. User entries are shown in...

  • A Fibonacci sequence is a series of numbers where the next number in the series is...

    A Fibonacci sequence is a series of numbers where the next number in the series is the sum of the previous two numbers. The sequence starts with the numbers 0 and 1. Here are the first ten numbers of the Fibonacci sequence:             0 1 1 2 3 5 8 13 21 34 Write a Java program to print out the first fifteen numbers of the Fibonacci sequence using a loop. You will need three variables previous, current, and next...

  • Fibonacci Sequence The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5,...

    Fibonacci Sequence The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is found by adding up the two numbers before it. The 2 is found by adding the two numbers before it (1+1) The 3 is found by adding the two numbers before it (1+2), And the 5 is (2+3), and so on!         Example: the next number in the sequence above is 21+34 = 55 Source:...

  • The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .......

    The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... It is defined by the following mathematical expression, with X0 & X1 being 0 and 1, respectively: Xn = Xn-1 + Xn-2 Write a C program using the fork() system call that generates and prints the Fibonacci sequence in the child process. The number of members in the sequence will be determined by a user provided as a user prompted input. Make the parent...

  • Check the words in bold. The Fibonacci sequence is the series of numbers 0,1,1, 2, 3,...

    Check the words in bold. The Fibonacci sequence is the series of numbers 0,1,1, 2, 3, 5, 8,.... Formally, it can be expressed as: fib0 = 0 fib1 = 1 fibn = fibn-1 + fibn-2 Write a multithreaded program that generates the Fibonacci sequence using the Win32 thread library(not pthreads because it does not work on windows). This program should work as follows: The user will enter on the command line the number of Fibonacci numbers that the program is...

  • Write a recursive static method that will return the n’th term in the Fibonacci series, a...

    Write a recursive static method that will return the n’th term in the Fibonacci series, a series of numbers in which each number is the sum of the two preceding numbers. The first terms are 1, 1, 2, 3, 5, 8, 13, … Therefore fibonacci(5) will return 5.

  • Write a Java program that generates an array of Fibonacci numbers. Specifications: The program -Fills a...

    Write a Java program that generates an array of Fibonacci numbers. Specifications: The program -Fills a one-dimensional array with the first 30 Fibonacci numbers using a calculation to generate the numbers. Note: The first two Fibonacci numbers 0 and 1 should be generated explicitly as in -long[] series = new long[limit]; //create first 2 series elements series[0] = 0; series[1] = 1; -But, it is not permissible to fill the array explicitly with the Fibonacci series’ after the first two...

  • use Java please. The Fibonacci Sequence Given the initial Fibonacci numbers 0 and 1, we can...

    use Java please. The Fibonacci Sequence Given the initial Fibonacci numbers 0 and 1, we can generate the next number by adding the two previous Fibonacci numbers together. For this sequence, you will be asked to take an input, denoting how many Fibonacci numbers you want to generate. Call this input upperFibLimit. The longest Fib sequence you should generate is 40 and the shortest you should generate is 1. So,1<upperFibLimit<40 The rule is simple given f(0) 0, f(1) 1 ....

  • Mips assembly help with fibonacci series

    Goal is to find nth Fibonacci number. Indexing needs to start at 0. The program has to look like the example and I am having trouble programing something that willwork. Also, it must ask if the user would like to find another number at the end. Can someone please help?!? It must be in MIPS assembly programing, not Java.Example:Which Fibonacci number do you want: 7Output: Number is 13 and the series is 0, 1, 1, 2, 3, 5, 8, 13Do...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT