#include <iostream>
using namespace std;
int n;
int main() {
cout<<"Który wyraz ciągu Fibonacciego chcesz wyliczyć?"<<endl;
cin>>n;
int a = 0;
int b = 1;
int wynik;
for (int i=0; i<n; i++){
wynik = b;
b=b+a;
a=b-a;
}
cout<<"n-ty ciąg Fibonacciego wynosi: "<< wynik;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.