367 views

1 Answer

Best answer
4 votes
4 votes

Ans is

8*7 + 7*6 + 6*5 + 5*4 = 148

How?

find () will return a*b

Initially

i = sizeof(arr) /sizeof(int) = 10/2 =5

First Iteration :

--i = 4

res = res + find (*(arr+4), a[3]) = find (8,7) = 56

Second Iteration :

--i = 3

res = res + find (*(arr+3), a[2]) = find (7,6) = 42

Third Iteration :

--i = 2

res = res + find (*(arr+2), a[1]) = find (6,5) = 30

Fourth Iteration :

--i = 1

res = res + find (*(arr+1), a[0]) = find (5,4) = 20

Fifth Iteration :

--i = 0 break

Hence res = 56+42+30+20 = 148

selected by

Related questions

0 votes
0 votes
1 answer
1
2 votes
2 votes
1 answer
3
0 votes
0 votes
1 answer
4
Nishi Agarwal asked Mar 10, 2019
614 views
void f(int x,int &y,const int &z){x+=z; y+=z;}int main(){ int a=22,b=33,c=44; f(a,b,c); f(2*a-3,b,c); printf("a=%d b=%d c=%d",a,b,c); return 0;}