Advertisement
makispaiktis

FIBONACCI

Jan 4th, 2018 (edited)
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #define n 100
  3.  
  4. int main(){
  5.  
  6.   long int matrix[n];
  7.   int i;
  8.   matrix[0]=matrix[1]=1;
  9.  
  10.   for(i=2; i<n; i++){
  11.   matrix[i]=matrix[i-1]+matrix[i-2];
  12.   }
  13.  
  14.   int j;
  15.   for(j=0; j<n; j++){
  16.   printf("The %dth Fibonacci's sequense's string is equal to %ld.\n", j+1, matrix[j]);
  17.   }
  18.  
  19.   return 0;
  20.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement