ICSE Class 9 Computer Applications
Question 6 of 16
Mathematical Library Methods — Question 6
Back to all questions 6
Question Question 6
Write a program to print:
i. p to the power q
ii. the square root of p
The values of p and q are 64 and 2 respectively.
public class KboatNumber
{
public static void main(String args[]) {
int p = 64;
int q = 2;
double r1 = Math.pow(p, q);
System.out.println("p to the power of q = " + r1);
double r2 = Math.sqrt(p);
System.out.println("Square root of p = " + r2);
}
}Output
