how do i convert t[i-3] and t[i-1] into an addable value? For example: i = 3, 3 % 2 != 0, cout<<3<<” “<<t[3-1] % 7 (so -> 1 % 7 = 1)<<endl;
#include <iostream>
using namespace std;
int main(){
int i = 0;
int t[i];
cout<<"i"<<" "<<"t[i]"<<endl; //headers
for (i;i < 11;i++){
if (i < 3){
t[i] = 1;
cout<<i<<" "<<t[i]<endl;
}
if (i >= 3){
if (i % 2 == 0){
cout<<i<<" "<<"t[i-3] + t[i-1] + 1"<<endl;
}
else
cout<<i<<" "<<"t[i-1] % 7"<<endl;
}
}
return 0;
}
i want this code to be as simple as it can be (cmath could be used if needed)
i TRIED to implement an additional variable for counting the highest number but could not figure out how to tie it together.
New contributor
Wojciech Ochojski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2