Giving correct output for 2 cases. Please help in resolving. Thanks. Given below is my code:
#include
using namespace std;
int main(){
long n, third;
cin>>n;
long first =0, second = 1;
cout<<first<<endl;
cout<<second<<endl;
third=first+second;
while(third<n){
cout<<third<<endl;
first = second;
second = third;
third = first + second;
}
return 0;
}