0% found this document useful (0 votes)
3 views6 pages

Mathematical Library Methods

The document contains Java programs that demonstrate various mathematical operations using the Math library. Each program prompts the user for input and performs calculations such as finding the smallest and largest numbers, calculating the hypotenuse of a triangle, determining absolute values, averages of marks, and the radius of a circle from its area. The programs are structured with a main method and utilize the Scanner class for user input.

Uploaded by

yajatyadav78
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Mathematical Library Methods

The document contains Java programs that demonstrate various mathematical operations using the Math library. Each program prompts the user for input and performs calculations such as finding the smallest and largest numbers, calculating the hypotenuse of a triangle, determining absolute values, averages of marks, and the radius of a circle from its area. The programs are structured with a main method and utilize the Scanner class for user input.

Uploaded by

yajatyadav78
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MATHEMATICAL LIBRARY METHODS

(UNSOLVED JAVA PROGRAMS)

________________________________________________________________

Q1
import [Link].*;
public class Q1{
public static void main(){
Scanner sc = new Scanner([Link]);
[Link]("Enter the first number");
int a = [Link]();
[Link]("Enter the second number");
int b = [Link]();
[Link]("Enter the third number");
int c = [Link]();

int min = [Link](a,b);


int fmin = [Link](min,c);
[Link]("The smallest number is "+fmin);

int max = [Link](a,b);


int fmax = [Link](max,c);
[Link]("The greatest number is "+fmax);
}
}
________________________________________________________________
Q2
import [Link].*;
public class Q2{
public static void main(){
Scanner in =new Scanner([Link]);
[Link]("Enter the perpendicular of the triangle");
double p = [Link]();
[Link]("Enter the base of the triangle");
double b = [Link]();

double h = [Link](p*p + b*b);


[Link]("The hypotenuse of the triangle "+h);
}
}

________________________________________________________________
Q3
import [Link].*;
public class Q3{
public static void main(){
Scanner in = new Scanner([Link]);
[Link]("Enter a number");
double a = [Link]();

double abs = [Link](a);


[Link]("The absolute value of the number "+abs);

double sq = [Link](a);
[Link]("The square root of the number "+sq);

double cu = [Link](a,3);
[Link]("The cube of the number "+cu);
double ran = [Link]();
[Link]("The random number between 0 and 1 " +ran);

}
}

________________________________________________________________
Q4
import [Link].*;
public class Q4{
public static void main(){
Scanner in = new Scanner([Link]);
[Link]("Enter Physics marks");
double p = [Link]();
[Link]("Enter Chemistry marks");
double c = [Link]();
[Link]("Enter Biology marks");
double b = [Link]();

double sum = p+c+b;


double avg = sum/3.0;
[Link]("The average of the marks is "+avg);
}
}

________________________________________________________________
Q5
import [Link].*;
public class Q5{
public static void main(){
Scanner in = new Scanner([Link]);
[Link]("Enter the area of the circle ");
double a = [Link]();

double r = [Link](7*a/22);

[Link](" The radius of the circle "+r);


}
}

You might also like