0% found this document useful (0 votes)
29 views

Int Int Int Int /N %D For Int %D/T

This C program uses recursion to calculate and print the Fibonacci sequence up to a number entered by the user. It defines a fibo function that recursively calls itself to calculate individual Fibonacci numbers, and a main function that calls fibo and prints the results of each call in a loop up to the user-input number.

Uploaded by

snehal patil
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Int Int Int Int /N %D For Int %D/T

This C program uses recursion to calculate and print the Fibonacci sequence up to a number entered by the user. It defines a fibo function that recursively calls itself to calculate individual Fibonacci numbers, and a main function that calls fibo and prints the results of each call in a loop up to the user-input number.

Uploaded by

snehal patil
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

h>

int fibo(int n);

int main()
{
int n;
printf("enter till what number you want fibonacci\n");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
printf("%d\t",fibo(i));
}
}

int fibo(int val)


{
if(val==1||val==0)
return 1;
else
return fibo(val-1)+fibo(val-2);
}

You might also like