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

Assignment Help:

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;}

}

 


Related Discussions:- C program to print fibonacci series

Help me for an programming contest .., Pebble Merchant Problem Description...

Pebble Merchant Problem Description There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides

Cpp, At a shop of marbles, packs of marbles are prepared. Packets are named...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Webcam driver static library or dll required for windows, Webcam Driver sta...

Webcam Driver static library or DLL required for Windows I want a .dll or .lib file using which i will take a snapshot from the webcam and it can't turn on the webcam LED while

Array, how to do an array

how to do an array

Destructor , How can I handle a destructor that fails? Need help please pro...

How can I handle a destructor that fails? Need help please provide example also.

Write a c program as text layout, Your task in this project is to write a C...

Your task in this project is to write a C program named layout.c which does text layout. This is a staged project, complete the stages in order. The maximum mark if you nish each

Html, world wide web

world wide web

Microprocessors and motherboards, The heart of the modern electronic system...

The heart of the modern electronic system is the microprocessor e.g. the video, sound, game consoles, portable phones and domestic appliances. Let us consider the heart of a home c

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd