Tuesday, March 1, 2016

Fibonacci Series in C

1:  #include <stdio.h>  
2:    
3:  int main(){  
4:        
5:      int count,n,x=0,y=1,display=0;  
6:      printf("Enter your term number:\t");  
7:      scanf("%d",&n);  
8:      printf("your fibonacci series is: %d+ %d+",x,y);  
9:      count=2;  
10:        
11:      while (count<n){  
12:          display=x+y;  
13:          x=y;  
14:          y=display;  
15:          ++count;  
16:          printf("%d+",display);  
17:            
18:      }  
19:        
20:      return(0);  
21:  }  

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)