Since the output is 29, I guess that would be confusing.
Perhaps you mis-read the <=7 as <7.
Anyway, to resolve confusion, add some debug printing.
1 2 3 4 5 6 7 8 9 10 11
#include<iostream>
usingnamespace std;
int main(){
int i,t=4;
for(i=3;i<=7;i++) {
cout << "Adding " << i << " to " << t << endl;
t=t+i;
cout << "T is now " << t << endl;
}
cout<<t;
}