GerexD

dinamikus-lepcsos

Feb 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,a[50];
  8. cout<<"Hany lepcsofok:";
  9. cin>>n;
  10. a[1]=1;
  11. a[2]=1;
  12. for(int i=3;i<=n;i++)
  13. {
  14. a[i]=a[i-1]+a[i-2];
  15. cout<<i<<". lepcsofokra "<<a[i]<<" fele keppen lephetek."<<endl;
  16. }
  17. return 0;
  18. }
Add Comment
Please, Sign In to add comment