solve this.....hi hi hi
Java
Answers
Answer:
Section A
Q1.
1. Math.pow() function is used to find the value of index of a number expressed in exponential form. For example: Math.pow(2,n) means 2ⁿ .
2. Math.sqrt() function is used to find the square root of the number written in the brackets. For example: Math.sqrt(4)= 2.0
3. Math.cbrt() function is used to find the cube root of the number written in the brackets. For example: Math.cbrt(8)= 2.0
4. Math.ceil() function returns the smallest integer which is greater than or equal to the argument. For example: Math.ceil(8.4)= 9.0
5. Math.abs() function return the absolute value of an argument. For example: Math.abs(5) = 5 or Math,abs(-5) = 5
6. Math.floor() function returns the largest integer which is less than or equal to the argument. For example: Math.floor(8.7)= 8.0
7. Math.max() function returns the maximum two arguments.
8. Math.min() function returns the minimum two arguments.
9. Math.PI stores the mathematical value of π (pie).
10. Math.random() function returns a random number between 0 and 1.
Section B
Q2
import java.util.*;
public class largest
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b,max;
System.out.println("Enter 2 numbers: ");
a= in.nextInt();
b=in.nextInt();
max = Math.max(a,b);
System.out.println("Largest number: "+max);
}
}
Q3
public class program
{
public static void main(String args[])
{
int p=64,q=2;
double r1,r2;
r1= Math.pow(p,q);
r2= Math.sqrt(p);
System.out.println("Result 1: "+r1);
System.out.println("Result 2: "+r2);
}
}
********************************************************************************
Hope it helps you...
Please mark it as brainliest...
Answer:
1. Math.pow() function is used to find the value of index of a number expressed in exponential form. For example: Math.pow(2,n) means 2ⁿ .
2. Math.sqrt() function is used to find the square root of the number written in the brackets. For example: Math.sqrt(4)= 2.0
3. Math.cbrt() function is used to find the cube root of the number written in the brackets. For example: Math.cbrt(8)= 2.0
4. Math.ceil() function returns the smallest integer which is greater than or equal to the argument. For example: Math.ceil(8.4)= 9.0
5. Math.abs() function return the absolute value of an argument. For example: Math.abs(5) = 5 or Math,abs(-5) = 5
6. Math.floor() function returns the largest integer which is less than or equal to the argument. For example: Math.floor(8.7)= 8.0
7. Math.max() function returns the maximum two arguments.
8. Math.min() function returns the minimum two arguments.
9. Math.PI stores the mathematical value of π (pie).
10. Math.random() function returns a random number between 0 and 1.
Section B
Q2
import java.util.*;
public class largest
public static void main(String args[])
Scanner in = new Scanner(System.in);
int a,b,max;
System.out.println("Enter 2 numbers: ");
a= in.nextInt();
b=in.nextInt();
max = Math.max(a,b);
System.out.println("Largest number: "+max);
}
}
Q3
public class program
{
public static void main(String args[])
{
int p=64,q=2;
double r1,r2;
r1= Math.pow(p,q);
r2= Math.sqrt(p);
System.out.println("Result 1: "+r1);
System.out.println("Result 2: "+r2);
Hope it helps you