C program to print fibonacci series, C/C++ Programming

C program to print fibonacci series:

int fibo(long int);

void main()

{

                long int a=0,n;

                printf ("how many terms\n");

                scanf("%d",&n);

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

                {a=fibo(i);

                printf("%d ",a);

                }

}

fibo(long int m)

{

                long int x;

                if(m>2)

                {

                x=fibo(m-1)+fibo(m-2);

                return x;

                }

                else if(m==2)

                                return 1;

                else if(m==1)

                {return 0;}

}

 

Posted Date: 9/29/2012 7:24:36 AM | Location : United States







Related Discussions:- C program to print fibonacci series, Assignment Help, Ask Question on C program to print fibonacci series, Get Answer, Expert's Help, C program to print fibonacci series Discussions

Write discussion on C program to print fibonacci series
Your posts are moderated
Related Questions
I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of π using a simulation method called "Monte Carlo". The following fi

what is the purpose of pointer ? what is the syntax? how it works?

Respected Sir, I want the above written text in a C program

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

(a) Verify the values of the resistors with the following colour coding: (i) red-red-orange-silver (ii) orange-orange-black-blue-green (b) What is the value of a resistor

hello i have about 15 hours the dead line I Need a program in c language that''s determine the router ip or the gateway ip of the current NIC example the router ip is: 192.168.1.1

# Dear I want help to programmer that write C++ code for my small project as soon as posible If we can help me?..

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

Define the Classification of Operators in C Language? Depending on the function performed the operator can be classified as 1. Arithmetic Operator 2. Logical Operator 3. Inc