//g++ -Wall -o 1 1.cpp
//./1
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n;
cin>>n;
if (n == 0){
cout<<0;
return 0;
}
else{
int a1 = 0 , a2 = 1;
int c = 1;
while(a2<=n){
if (a2==n){
cout<<c;
return 0;
}
a1 = a2;
a2 = a1+a2;
c++;
}
cout<<-1;
return 0;
}
}
Объяснение:
while True:
n = int(input('Введите количество чисел в последовательности: '))
if 0 < n <= 1000: break
print('Вводите натуральное число, не превышающее 1000!')
minimal = None
for i in range(n):
while True:
value = int(input(f'Введите {i+1}-е число: '))
if 0 < value <= 30000: break
print('Вводите натуральное число, не превышающее 30000!')
if value % 10 == 6 and (minimal is None or minimal > value): minimal = value
print(minimal)