Solved

# help with functions

Posted on 1997-11-12

how do I construct mulitple functions (one for substration and division) and print the numbers based on Fibonacci series.

Ihave included the basic code for the first part of the program...I need to add a function to subtract and display the difference between succeeding numbers and also a function to calculate and display the quotients of the succeeding series in a third colum.

the display might look like this:

0

1 0 1.000000

2 1 2.000000

3 2 1.500000

5 3 1.666667

8 5 1.600000

13 8 1.625000

and so on...

/* Fibonacci series */

/* Assignment 7 */

int a = 0, b = 1, c = 0;

main()

{

int sum();

int subtract();

printf("Fibonacci\n");

printf("%5d \n", a);

printf("%5d \n", b);

do

{

c = sum(a, b);

printf("%5d\n", c);

a = b;

b = c;

}

while (c < 10000);

}

int sum(x, y)

int x, y;

{

return x + y;

}

I' ve complied this portion and it works but everything I try fro the next function is a bust...any HELP would be appreciated. Thanks