Computer Science, asked by saniyasinha716, 1 month ago

What is the value stored in variable p given below:
double p = Math.pow ("1234", indexOf('4"), 3);​

Answers

Answered by BrainlyProgrammer
7

 \tt \green{double \: p = Math.pow ("1234".indexOf("4"), 3);} \\ \tt  > > Math.pow (3, 3) \\ \underline{  \orange{\boxed{  \green{\boxed{ \orange{  >  > 9.0} }}}}}

Explaination:-

  •  \tt \boxed{ \tt \: index \over \tt characters} =  > \boxed{ 0 |1 |2 |3\over1 |2 |3 |4 }
  • The above shows the string "1234" above which the index of each characters are given.
  • Remember: Index starts with 0.
  • indexOf() returns the index of character given in the parameter.
  • Here the string is "1234" of whose index of 4 we have to find.
  • Refer to the first point which shows index of each character . As we can see, index of "4" is 3

Now,

Math.pow(3,3)

>>9.0

  • Because Math.pow() returns number raised to power other number in double data type.

Correct Answer:-

  • 9.0
Answered by BrainlyPARCHO
0

\large { \fcolorbox{gray}{black}{ ✔\: \textbf{Verified \: answer}}}

doublep=Math.pow("1234".indexOf("4"),3);

>>Math.pow(3,3)

>>9.0

Similar questions