Advertisement
rilo

Fibonacci sequence for KickC

Dec 4th, 2020
1,318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include "c64.h"
  2. #include "stdio.h"
  3.  
  4. void main() {
  5.     unsigned int z = 32768;
  6.     unsigned int s0 = 0;
  7.     unsigned int s1 = 1;
  8.     unsigned int y;
  9.  
  10.     clrscr();
  11.     printf("%u\n",s0);
  12.     printf("%u\n",s1);
  13.  
  14.     while (y < z) {
  15.         y = s0 + s1;
  16.         if (y < z) {
  17.             printf("%u\n",y);
  18.             s0 = s1;
  19.             s1 = y;
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement