Computer Science, asked by sandysri1977, 3 months ago

What will be the value of p and q after evaluating the following: int A[]={26,29,52,37,78}; int p=(A[3]+A[4]); int q=(A[1+2]+15);​

Answers

Answered by duragpalsingh
3

Answer:

p = 115

q = 52

Explanation:

Concept: An array declared in java, starts with index 0 to n.

so, indexing would be like, A[0] = 26, A[1] = 29 etc.

given, int p = (A[3] + A[4]);

from array, A[3] = 37 and A[4] = 78.

i.e p = ( 37 + 74) = 115

i.e p = 115

and, int q = (A[1+2] + 15);

i.e q = (A[3] + 15)

or, q = 37 + 15

or, q = 52

Similar questions