C Program to Print Fibonacci Series using Recursion

Write a C program to print Fibonacci Series using recursion. Given an input number, we have to write a code to print Fibonacci series up to that number using Recursion.

This question is very important in terms of technical interviews.

You can check my previous post for PHP script to print Fibonacci series. Before solving this problem, Let’s first understand what is Recursion?

What is Recursion?

In recursion, A function calls itself until the base condition is reached. Recursive code is much cleaner and shorter as compared to iterative code.
For better understanding you can check my previous post on recursion and what’s the difference between recursion and iteration.

For better understanding of  recursion concept, you can solve Objective Question on Recursion.

Using Interface in PHP

What is an interface in PHP? An interface is an important concept in an object oriented programming.

In this tutorial, we’ll discuss following points.

1. What is an interface?

2. How to create an interface in PHP.

3. What’s the importance of using an interface in our PHP application?

Interface in PHP

Interface in PHP

What is an Interface in PHP?

An Interface defines a contract for what a class can do, without saying anything about how the class can do it. Through interfaces, we define what a class can do, the classes that implement interface define how it can do it.

To understand the concept of an interface let’s take an example of a caching system. There are different types of caching available such as File system, Memcache, Redis etc. First, we need to define what a cache can do (I mean different operations), how we do it? we can do it through an interface. A class (Such as Memcache, Redis etc) which implements cache interface will define how they will do it.

NOTE – An interface will not add any additional functionality in your code but it outlines a standard format to which your classes need to use.