Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int n;
  5. float ciag(int n){
  6.     if(n==0){
  7.         return 0;
  8.     }
  9.     if(n==1){
  10.         return 0.5;
  11.     }
  12.     else{
  13.         n=ciag(n-1)-(2*ciag(n-2));
  14.         return n;
  15.     }
  16. }
  17. int main(int argc, char *argv[])
  18. {
  19.     ciag(2);
  20.     printf("%0.2f\n",ciag(2));
  21.  
  22.   system("PAUSE"); 
  23.   return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement