Advertisement
Guest User

2.

a guest
Dec 6th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main (void)
  7. {
  8.  
  9. int r=0,a=0,n,b=1,i;
  10. char redo;
  11. do
  12. {
  13. a=0;
  14. b=1;
  15. cout<<"enter the the value of n:";
  16. cin>> n;
  17. if(n>100){
  18. cout<<"enter some lessor value"<<endl;
  19. }
  20. else{
  21. cout<<a<<endl;
  22. for (i=0;i>=n;i++)
  23. {
  24. c=a+b;
  25. a=b;
  26. b=c;
  27. cout<<"serial no."i+1<<"==";
  28. cout<<a <<endl;
  29. }
  30. cout<<"enter y or Y to continue:";
  31. cin>>redo;
  32. cout<<endl<<endl;
  33. }
  34. }
  35. while(redo=='y'||redo=='Y');
  36.  
  37.  
  38. system("pause");
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement