Dry Run the given code:
int num; cin>>num;
int t1 = 0;
int t2 = 1;
int newTerm;
for (int i= 1; i<=num ; i=i+1 ){
if(i==1){
cout << t1<< endl;
}
if (i==2){
cout << t2 << endl;
}
newTerm= t1 + t2;
t1= t2;
t2= newTerm;
}
12
0
1
Program ended with exit code: 0
Comments
Leave a comment