What will be the output of following program? [2M]
class Power
{
public static void main ( )
{
Double a, b, c ;
a = 2.0;
b = 3.0;
c= Math.pow (a,b) ;
System.out.print ( “ Power value is = “ + c);
}
}
Answers
Answer:
Power value is= 8.0
Explanation:
This is the correct answer.... please mark me as brainliest
Answer:
The output will be: Power value is = 8.0
Explanation:
Here's how:
Double a, b, c ;
Declaring a b c variables as doubles (decimal number)
a = 2.0;
telling the computer that a is equal to 2.0
b = 3.0;
telling the computer that b is equal to 3.0
c= Math.pow (a,b) ;
telling the computer that c is equal to the power of b to a which is a^b or 2.0^3.0 by the function Math.pow(a,b)
. the number / variable in the first of the bracket is base and next one is exponent / power or Math.pow(base,exponent)
System.out.print ( “ Power value is = “ + c);
this statement say the computer to print power value is = with the result which is 2.0x2.0x2.0=8.0 (Answer)
So, this is the final output:
Power value is = 8.0
Hope you got this and if you have any problem ask me in the comments.