Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
309 B
1
Indexable
#include <iostream>
using namespace std;
int main()
{
	int a, b, n, a1, a2;
	cin >> n;
	int count = 1;
	a = 0;
	a1 = 1;
	do
	{
		count++;
		a2 = a1 + a;
		a = a1;
		a1 = a2;
	} while (a2 < n);
	cout << a2;
	if (n == a2)
	{
		
		cout << "1 " << count ;
	}
	else
	{
		cout << "0";
	}
}