Question: double down ( int x [ ] , int cap, int &gap ) { double ans = 0 . 0 ; for ( int i

double down(int x[], int cap, int &gap){
double ans =0.0;
for (int i =0; i < cap; i+= gap)
ans += x[i];
gap +=2;
return ans /10;
}
int main(){
int x[4]={3,2,1,8};
int a =4, b =1;
cout << x[7/3]<< endl; // line (a)
cout << down(x, a, b)<< endl; // line (b)
cout << down(x, a, b)<< endl; // line (c)
cout << down(x, x[0], x[x[2]])<< endl; // line (d)
cout << x[1]<< endl; // line (e)
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!