# call a function

This is a discussion on call a function within the C Programming forums, part of the General Programming Boards category; My program prints out Fibonacci_number(0,1,1,2,3,5). The program is ok. My problem:I want to take a number from Fibonacci_number(0,1,1,2,3,5) and multiply ...

1. ## call a function

My program prints out Fibonacci_number(0,1,1,2,3,5). The program is ok.
My problem:I want to take a number from Fibonacci_number(0,1,1,2,3,5)
and multiply whit 10. ex: I want to take 3 and multiply with 10.
I tried to write another function and call a Fibonacci_number from fib(int k)
and then multiply it whit 10.
How can I call an exact Fibonacci_number.

Code:
int fib(int k)
{

int my_nbr=0;
int f;

int  nbr1 = 0;
int  nbr2 = 1;
printf("0,1");

for (f = 2; f < k; ++f)
{
printf(",%d", nbr1 + nbr2);

my_nbr= nbr2;
nbr2 = nbr2 + nbr1;
nbr1 = my_nbr;

}
printf("\n");

}

int main(void)
{
fib(6);

return 0;
}

2. well you have int fib(int k); so you want fib to return an int, so at the end you should have it return the fib number for the Kth iteration.

Then you can simply do:
Code:
int foo = 10*fib(bar);