/
lyapdy
/
skillbox_controllers
Обзор
Документация
Войти
/
lyapdy
/
skillbox_controllers
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
lesson1/main.cpp
30 строк
751 B
lyapdy
first commit
21 ноя 2025, 05:58
21 ноя 2025, 05:58
e71c2e4
Код
Авторство
О чём код?
#include <iostream> using namespace std; // ������� ��� ������ ������ n ����� ��������� void printFibonacci(int n) { int first = 0, second = 1, next; // ������� ������ ����� cout << first << " "; // ���������, ���������� �� ��������� if(n >= 2) cout << second << " "; // ����� ������� ����� for(int i=2; i<n; ++i){ next = first + second; // ��������� ����� ����� ����� ���� ���������� cout << next << " "; // ��������� �������� ������� � ������� ����� first = second; second = next; } } int main() { int n = 5; // ���������� �����, ������� ����� ������� cout << "������ " << n << " ����� ���������:\n"; printFibonacci(n); return 0; }