Advertisement
Guest User

урок 2

a guest
Jul 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main()
  6. {
  7.     system("chcp 1251");
  8.     system("cls");
  9.     int a,first=0,second=1,sum=1,t,count=1;
  10.     printf("Введите число :");
  11.     scanf("%d",&a);
  12.     while(sum<=a) {
  13.         count++;
  14.         sum=first+second;
  15.         first=second;
  16.         second=sum;
  17.  
  18.     }
  19.     printf("Всего чисел Фибоначчи не превосходящие %d : %d",a,count);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement