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

First line starts with T, number of test cases. Each test case T contains a necklace (N).

Cross Platform Clinet app for a vpn Project Description: We want a cross platform client app for VPN. The app must have the subsequent options below: 1. Must be an open

why oops

A string is said to be "Beautiful"€, if it contains only non repetitive alphabets

Charity Ball Organizer Many charities support good causes, but one of the difficulties each of them has is organizing their fundraising events. After nearly a semester of C progra

Explain the Loop Statements in Computer Programming? 1. C gives you a choice of three kinds of loop, while, do while and for. 2. The while loop remain repeating an action until

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Program1: Write a program to find the factorial of a given number. The input is user given. Final output is printed out on to the screen. Program2: Write a program to gene

The goto statement This statement can be used to branch to another statement of the program. This is rarely used as it violates the principle of structured programming. Though