Math, asked by sapanrock, 1 month ago

(c) If int x 1 = {2, 5, 6, 8, 10}; what are the values of p and q?
(i) p = length;
(ii) q =Math.sqrt(x [1] + x[4]) * x [0]);

help please!!!​

Answers

Answered by BrainlyProgrammer
10

Correct Question:-

If int x[]= {2, 5, 6, 8, 10}; what are the values of p and q?

(i) p = x.length;

(ii) q = Math.sqrt(x[1] + x[4]) * x [0]);

Required Answer:-

(i)

p=x.length;

//x.length will return the length of the array 'x' i.e. no. of elements in array 'x'

•°• p= 5

(ii)

q = Math.sqrt(x[1] + x[4]) * x[0]);

//Math.sqrt() returns the Square Root of a number. It returns in double data type.

So,

Math.sqrt(x[1] + x[4]) * x[0])

>>Math.sqrt(5+10*2)

>>Math.sqrt(5+20)

>>Math.sqrt(25)

>>5.0

•°• q=5.0

Correct Answer:-

  • p=5
  • q=5.0

Note

  • Index numbers always starts with 0

Similar questions