Advertisement
Guest User

Untitled

a guest
May 20th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. unsigned int cicl(unsigned int n)
  2. {
  3.   unsigned int counter;
  4.   int result;
  5.   int var;
  6.  
  7.   if (n == 0) {
  8.     result = 0;
  9.   }
  10.   else {
  11.     if (n == 1) {
  12.       result = 1;
  13.     }
  14.     else {
  15.       var = 0;
  16.       result = 1;
  17.       counter = 2;
  18.       while (counter <= n + 1) {
  19.         result = result + var;
  20.         var = result - var;
  21.         counter = counter + 1;
  22.       }
  23.     }
  24.   }
  25.   return result;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement