Advertisement
M1RAI

exx3

Dec 1st, 2020
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n,a,b,i,F;
  7.     a=1;
  8.     printf("n= ");
  9.     scanf("%d",&n);
  10.     if(n==0)
  11.     {
  12.         printf("F(%d)=%d",n,a);
  13.     }
  14.     else
  15.     {
  16.         if(n==1)
  17.         {
  18.             printf("F(%d)=%d",n,a);
  19.         }
  20.         else
  21.         {
  22.             i=2;
  23.             b=1;
  24.             F=0;
  25.             do
  26.             {
  27.                F=a+b;
  28.                a=b;
  29.                b=F;
  30.                i++;
  31.             }
  32.             while(i<=n);
  33.             printf("le %d ieme terme de cette suite est %d",n,F);
  34.         }
  35.     }
  36.  
  37.  
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement