**ALGORITHM:**
**STEP 1:** Start the program.

**STEP 2:** Declare the variable, *no, factorial, sum, p, i, and the function fact (int p), sum (int p), fib (int p).

**STEP 3:** Read the value of no.

**STEP 4:** Call the function fact (*no), sum (*no).

**STEP 5:** Use for loop call the function fib (int p) and display the Fibonacci series & also display factorial & summation.

**STEP 6:** Stop the program.

**FUNCTION FIB (int p) - FIBONACCI SERIES.**
**STEP 1:** Check whether the value of n is equal to '0' if so return '0'.

**STEP 2:** Else check whether (p >= 1 && p <= 2), if so return the value '1'.

**STEP 3:** Else return ( fib ( p – 1 ) + fib( p – 2 ) ).

**FUNCTION FACT (int p) - FACTORIAL OF A NUMBER.**
**STEP 1:** Check whether (p == 0), if so return '1' .

**STEP 2:** Else return (p * fact( p – 1 ) ).

**FUNCTION SUM (int p) - SUMMATION OF A NUMBER.**
**STEP 1:** Check whether p == 0, if so return '0'.

**STEP 2:** Else return (p + sum( p – 1 ) ).

**SAMPLE PROGRAM:**
#include<stdio.h>

#include<conio.h>

void main()

{

int i, p, *no, factorial, umm;

int fact (int p);

int sum (int p);

int fib (int p);

clrscr();

printf( " \n Enter The Number: " );

scanf( " %d ", no );

printf( " \n The Fibonnacci series: \n " );

for( i = 0; i < *no; i++ )

printf( " %d \n ", fib( i ) );

factorial = fact ( * no );

printf( " \n The factorial of %d: %d \n ", *no, factorial );

summ = sum ( *no );

printf( " \nThe summation of %d: %d \n ", *no, sum );

getch();

}

int fib(int p)

{

if( p == 0 )

return(0);

if( p >= 1 && p <= 2 )

return(1);

else

return( fib( p – 1 ) + fib( p – 2 ) );

}

int fact( int p )

{

if( p == 0 )

return(1);

else

return( p * fact( p – 1 ) );

}

int sum(int p)

{

if( p == 0 )

return(0);

else

return( p + sum( p – 1 ) );

}

**OUTPUT: **
Enter the Number: 5

The Fibonacci series: 0 1 1 2 3

The factorial of 5: 120

The summation of 5: 15

__ALSO READ:__

-- Program To Understand Working Of Address Concept.

-- Program On Use Of Array & Pointer Concept Together.

-- Program On Pointers & 2 - Dimensional Array.

-- Program On Strings Into Array Of Pointers.

-- Program To Accept & Add Ten Numbers Using Pointers.
**-- ****Program To Implement Minimum Spanning Tree Using Functions, Pointers & Structures.**

-- **Program To Implement 8 Queens Problem Using Arrays, Pointers & Functions.**
**-- ****Program To Implement Quick Sort Using Pointers, Functions & Arrays.**
**-- ****Program With Algorithm To Implement Bubble Sort Using Pointers.**

-- **Program To Implement Recursive Algorithm Using Pointers.**

-- **Program On Strings Into Array Of Pointers.**

-- **Program On Pointers & 2 - Dimensional Array.**

-- **Program On Use Of Array & Pointer Concept Together.**

-- **Program On Arithmetic Calculations Using Pointers.**

-- **Program To Add Two Numbers Using Pointers.**

-- **Program To Accept & Add Ten Numbers Using Pointers.**

... Back To C Program Index.
## Comments

## Post a Comment

Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...

Experienced guys can share their resumes at administrator@abapmadeeasy.com/admin@abaper.in