Code:
#include <malloc.h>
#include <stdlib.h>
#include <stdbool.h>

bool doContinue(){
    char ch, temp;
    printf("Do you want to contiue? Y/n ");


    temp = getchar(); //taking care the trailing \n in the input buffer
    ch = getchar();


    if(ch =='n')
        return false;

    return true;
}


int main()

{

    int NUM_FIBON;
    int *farray;
    int i;


    do{

        printf("Enter a number \t");
        scanf("%d",&NUM_FIBON);

        /* Display the purpose of the program */
        printf("\nThis program displays the first %d fibonacci numbers\n",NUM_FIBON);

        farray = (int *) malloc(NUM_FIBON);

        farray[0] = 1;
        farray[1] = 1;


        for (i = 2; i < NUM_FIBON; i++ )
        {
            farray[i] =farray[i -1] + farray[i - 2];

        }

        for (i = 0; i < NUM_FIBON; i++ )
        {
            printf(" %-8i ",farray[i]);
        }
    }while(doContinue());

}
this is an example, change the way you like..

Shaikat

Last edited by shabbir; 31Mar2009 at 07:37.. Reason: Code blocks