C programming

Showing posts with label recursively. Show all posts
Showing posts with label recursively. Show all posts

Monday, April 11, 2016

C program to find fabonacci series upto n using recursive technique

#include<stdio.h>
int fab(int i)
 {
  if(i==0)
   {
    return 0;
   }
  else if(i==1)
   {
    return 1;
   }
  else
   return fab(i-1)+fab(i-2);
 }
void main()
 {
  int n;
  printf("Enter no of terms");
  scanf("%d",&n);
  int i;
  for(i=0;i<n;i++)
   {
    printf(" %d ",fab(i));
   }
 
 }
output
Enter no of terms 6
0 1 1 2 3 5
Posted by Dinesh Agrawal at 7:50 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: C, fabonacci sequence using recursive technique, fabonacci series, generate fabonacci sequence, recursively
Older Posts Home
Subscribe to: Posts (Atom)

About Me

My photo
Dinesh Agrawal
View my complete profile

Blog Archive

  • ▼  2016 (61)
    • ▼  June (9)
      • C program to understand the concept of initializat...
      • C program to make two matrix dynamically and show ...
      • C program to calculate GCD (greatest common diviso...
      • C program to save and retrieve records from extern...
      • c program to find factorial of a number without us...
      • C program to select elements from three given arra...
      • c++ program to show operation on time, add seconds...
      • C program to check given number in strong number o...
      • c program to count number of 1 in binary represent...
    • ►  May (14)
    • ►  April (15)
    • ►  March (23)
Simple theme. Theme images by fpm. Powered by Blogger.